Skip to content

Conversation

@klueska
Copy link
Collaborator

@klueska klueska commented Aug 20, 2025

Currently, in the compute domain driver, we unconditionally mount the host's /dev over the container's /dev regardless of what the devRoot of the GPU driver is. This change was introduced in #307.

Unfortunately, this causes some problems on certain systems as described in #477.

This patch makes this mount contingent on devRoot == "/" (which is the only case where we actually ever wanted / needed to have this mount in the first place.

Fixes: #477

@copy-pr-bot
Copy link

copy-pr-bot bot commented Aug 20, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@klueska klueska changed the title Conditionally mount the host's /dev over the contaienrs /dev Conditionally mount the host's /dev over the container's /dev Aug 20, 2025
@klueska klueska force-pushed the conditionally-mount-host-dev branch 2 times, most recently from c75825c to 0f2aa79 Compare August 20, 2025 13:16
Copy link
Collaborator

@jgehrcke jgehrcke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contingent on devRoot == "/"

makes sense!

Thanks, Kevin. I agree that a tiny patch here is a smart path forward (de-risking the introduction of new problems)

return helper(root)
}

// conditionallyBindMountHostDev bind mounts hostDevPath over /dev when devRoot is "/".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should we add a note as to why this is required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will add.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

nvidiaCapsDeviceName = "nvidia-caps"
nvidiaCapsImexChannelsDeviceName = "nvidia-caps-imex-channels"
nvidiaCapFabricImexMgmtPath = "/proc/driver/nvidia/capabilities/fabric-imex-mgmt"
hostDevPath = "/host/dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is this hostDevContainerPath?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Evan!

mounter := mount.New(mountExecutable)

// Bind mount hostDevPath over /dev
if err := mounter.Mount(hostDevPath, "/dev", "", []string{"bind"}); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we concerned that this leaks mounts to the host? Is this mount cleaned up if the container is terminated? (e.g. if mount propagation is bidirectional)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The host dev folder isn't mounted bidirectionally, but regardless I don't think anything will be leaked.

Unlike with the driver container where we perform mounts into a path that (in itself) has been hostPath-mounted into the container -- the bind mount we are performing here is over a path solely within the mount namespace of the container.

@klueska klueska force-pushed the conditionally-mount-host-dev branch from 0f2aa79 to 2b83dad Compare August 20, 2025 14:11
@klueska
Copy link
Collaborator Author

klueska commented Aug 20, 2025

Pushed changes to address comments from @elezar

@klueska klueska added the bug Issue/PR to expose/discuss/fix a bug label Aug 20, 2025
@klueska klueska force-pushed the conditionally-mount-host-dev branch from 2b83dad to ee4efec Compare August 20, 2025 18:44
Currently, in the compute domain driver, we unconditionally mount the
host's /dev over the container's /dev regardless of what the devRoot of
the GPU driver is. This change was introduced in
NVIDIA#307.

Unfortunately, this causes some problems on certain systems as described
in NVIDIA#477.

This patch makes this mount contingent on devRoot == "/" (which is the
only case where we actually ever wanted / needed to have this mount in
the first place.

Signed-off-by: Kevin Klues <[email protected]>
@klueska klueska force-pushed the conditionally-mount-host-dev branch from ee4efec to 9797d24 Compare August 20, 2025 21:12
@klueska klueska merged commit d755563 into NVIDIA:main Aug 21, 2025
7 checks passed
@klueska klueska moved this from Backlog to Closed in Planning Board: k8s-dra-driver-gpu Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-25.3 bug Issue/PR to expose/discuss/fix a bug

Projects

Development

Successfully merging this pull request may close these issues.

NVIDIA device nodes created at host's /dev break running privileged containers with cri-o

3 participants