feat(cdi/generate): add --no-ipc-sockets flag to exclude IPC sockets - #2086
Open
Pcmhacker-piro wants to merge 2 commits into
Open
Pcmhacker-piro wants to merge 2 commits into
Pcmhacker-piro wants to merge 2 commits into
Conversation
Pcmhacker-piro
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
September 13, 2026 08:06
When running containers under sandboxed runtimes like gVisor (runsc) or Kata Containers, bind mounting host IPC domain sockets (such as /run/nvidia-persistenced/socket, /run/nvidia-fabricmanager/socket, or /tmp/nvidia-mps) causes container creation to fail with ENXIO because sandboxed gofers open existing mount points with O_CREAT. Furthermore, multi-tenant and secure container environments often prohibit sharing host IPC sockets into untrusted containers. While nvcdi already implemented FeatureDisableIPCDiscoverer, it was never exposed as a flag or environment variable in nvidia-ctk cdi generate or systemd refresh services. This commit exposes: - CLI flag: --no-ipc-sockets (aliases: --disable-ipc-sockets, --disable-ipc-discoverer) - Environment variable: NVIDIA_CTK_CDI_GENERATE_NO_IPC_SOCKETS - Configuration option documented in nvidia-cdi-refresh.env - Comprehensive unit tests covering flag validation, spec generation, and nvcdilib discoverer toggling. Fixes NVIDIA#2034 Signed-off-by: Prakash Meena <pcmhacker511@gmail.com>
Pcmhacker-piro
force-pushed
the
fix/cdi-generate-no-ipc-sockets
branch
from
September 13, 2026 08:17
97638d1 to
491d214
Compare
Contributor
|
The PR looks good, but the argument to fix gvisor to properly handle IPC files holds true. What about the use case where one needs GPU utility capabilities? |
Author
|
Hi @rajatchopra, Thanks for the review! Regarding the
Also, I have merged the latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a dedicated
--no-ipc-socketsflag (with aliases--disable-ipc-socketsand--disable-ipc-discoverer) and a corresponding environment variableNVIDIA_CTK_CDI_GENERATE_NO_IPC_SOCKETStonvidia-ctk cdi generate. This allows excluding NVIDIA IPC domain sockets (/run/nvidia-persistenced/socket,/run/nvidia-fabricmanager/socket, and/tmp/nvidia-mps) from generated CDI specifications.Changes proposed in this pull request:
CLI & Spec Generation (
cmd/nvidia-ctk/cdi/generate/)--no-ipc-sockets(aliased to--disable-ipc-socketsand--disable-ipc-discoverer) with source env varNVIDIA_CTK_CDI_GENERATE_NO_IPC_SOCKETS.validateFlags, whennoIPCSocketsis enabled,nvcdi.FeatureDisableIPCDiscovereris automatically appended toopts.featureFlags.TestGenerateSpec/no-ipc-socketsingenerate_test.goverifying flag validation and CDI specification output without IPC mounts.Systemd Configuration (
deployments/systemd/)nvidia-cdi-refresh.envdocumentingNVIDIA_CTK_CDI_GENERATE_NO_IPC_SOCKETS=truefor sandboxed container runtimes (such as gVisorrunscor Kata Containers).NVCDI Library & Discoverer (
pkg/nvcdi/&internal/discover/)pkg/nvcdi/driver-nvml_test.goasserting thatnewIPCDiscovererreturns the discoverer by default, but returnsnil, nilwhenFeatureDisableIPCDiscovereris toggled.internal/discover/ipc.godoc comment (creats->creates).Checklist
make test)go vet)How to test this:
go run ./cmd/nvidia-ctk cdi generate --help | grep -C 1 no-ipc-socketsgo test -v ./cmd/nvidia-ctk/cdi/generate/...go test -v -run TestNewIPCDiscoverer ./pkg/nvcdi/...Demonstration & Proof:
Terminal Recording (Video Demo)
Verification Screenshot