Repository navigation
Conversation
requestsFromMounts tests the container mount destination with strings.HasPrefix against /var/run/nvidia-container-devices and then trims that prefix, so a sibling path with the same leading characters is read as a device request: /var/run/nvidia-container-devices-backup/GPU0 -> device "-backup/GPU0" /var/run/nvidia-container-devicesimex/0 -> IMEX channel "0" /var/run/nvidia-container-devicescdi/n.com/gpu=0 -> CDI device "n.com/gpu=0" The first fails the container with an unresolvable device name. The other two are worse than that, because the request looks valid: a /dev/null mount at a path that is not below the device root ends up requesting an IMEX channel, or a fully qualified CDI device, which also sends the container down the OnlyFullyQualifiedCDIDevices path. Require the separator. A destination equal to the root is still ignored, as before, and the existing "Container path is only 'root'" case covers it. Signed-off-by: Dmitry Voropaev <dy.voropaev@gmail.com>
v0ropaev
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
October 8, 2026 12:08
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.
requestsFromMountschecks the container mount destination against/var/run/nvidia-container-deviceswithstrings.HasPrefixand then trims that prefix off. No separator is required, so a sibling path with the same leading characters is read as a device request.Observed on
mainwithaccept-nvidia-visible-devices-as-volume-mountsenabled, host path/dev/null:/var/run/nvidia-container-devices-backup/GPU0-backup/GPU0/var/run/nvidia-container-devices.old/GPU1.old/GPU1/var/run/nvidia-container-devicesimex/00/var/run/nvidia-container-devicescdi/nvidia.com/gpu=0nvidia.com/gpu=0The first two fail the container with an unresolvable device name. The last two are quieter: the request that comes out is well formed, so a
/dev/nullmount at a path that is not below the device root requests an IMEX channel, or a fully qualified CDI device, which also makesOnlyFullyQualifiedCDIDevicesreturn true and takes the container down the CDI path.The fix requires the separator. A destination equal to the root is still ignored, which is what the existing
Container path is only 'root'case asserts.Tests
Added to
TestGetVisibleDevicesFromMounts: a sibling of the root with two mounts, and thecdiprefix case. NewTestImexChannelsFromMountscovers channels below the root and theimexprefix case, since nothing tested that path.Three of the new subtests fail on
main, each with the value from the table above.go test ./internal/...passes,go vet ./internal/config/...andgofmtclean.