daemon: preserve CDI additional GIDs#52579
Merged
Merged
daemon: preserve CDI additional GIDs#52579
Conversation
elezar
commented
May 8, 2026
| WithNamespaces(daemon, c), | ||
| WithCapabilities(c), | ||
| WithSeccomp(daemon, c), | ||
| withMounts(daemon, daemonCfg, c, mounts), |
Contributor
Author
There was a problem hiding this comment.
I've just noted that withMounts is called after WithDevices which could also inject mounts over CDI. We may need to investigate whethere there are edge cases here that may lead to unexpected behaviour, but I suppost having command line mounts preferred over CDI mounts is fine.
CDI injection runs from WithDevices and may append supplementary groups to process.user.additionalGids. Docker's WithUser option previously ran afterwards and replaced Process.User, dropping any CDI-provided groups. Resolve the final container user before device injection so CDI edits append to that user, and add regression coverage for a CDI v0.7 spec that injects additionalGids. Signed-off-by: Evan Lezar <elezar@nvidia.com>
elezar
force-pushed
the
fix-cdi-additional-gids
branch
from
May 8, 2026 13:24
075cf45 to
704210f
Compare
corhere
approved these changes
May 11, 2026
crazy-max
approved these changes
May 12, 2026
6 tasks
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 I did
Ensured that the addition of the user to the OCI spec runs before CDI injection. This is required to allow additional (non-root) group IDs to be added to the OCI spec if required for device nodes, for example. One case where this is applicable is on certain NVIDIA systems where device nodes have
660permisions and are owned byroot:video:This injection is equivalent with running
dockerwith--group-add.- How I did it
Reordered the functional modifers of the OCI spec so that
WithUsersis called beforeWithDevices(which triggers CDI device injection).- How to verify it
Create the following CDI spec at
/var/run/cdi/additional-gid-test.yaml:(also specified in the tests).
Running id in a container requesting the device should show the additional group:
(this is equivalent to running
--group-add:(remove the created file).
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)