Skip to content

Commit 43c865f

Browse files
faganihajizadasoharaa
authored andcommitted
fix(discover): remove ro mount option from IPC sockets
IPC sockets (nvidia-persistenced, nvidia-fabricmanager, nvidia-mps) no longer include the "ro" mount option. This matches the behavior of libnvidia-container and allows nested container runtimes like enroot to bind-mount these sockets. Signed-off-by: Fagani Hajizada <fhajizada@nvidia.com> (cherry picked from commit fb15d14)
1 parent 38d26bf commit 43c865f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

internal/discover/ipc.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ import (
2121
"github.com/NVIDIA/nvidia-container-toolkit/internal/lookup"
2222
)
2323

24+
// ipcMountOptions defines the mount options for IPC sockets.
25+
var ipcMountOptions = []string{
26+
"nosuid",
27+
"nodev",
28+
"rbind",
29+
"rprivate",
30+
"noexec",
31+
}
32+
2433
type ipcMounts mounts
2534

2635
// NewIPCDiscoverer creats a discoverer for NVIDIA IPC sockets.
@@ -60,7 +69,7 @@ func NewIPCDiscoverer(logger logger.Interface, driverRoot string) (Discover, err
6069
return d, nil
6170
}
6271

63-
// Mounts returns the discovered mounts with "noexec" added to the mount options.
72+
// Mounts returns the discovered mounts with IPC-specific mount options.
6473
func (d *ipcMounts) Mounts() ([]Mount, error) {
6574
mounts, err := (*mounts)(d).Mounts()
6675
if err != nil {
@@ -70,7 +79,7 @@ func (d *ipcMounts) Mounts() ([]Mount, error) {
7079
var modifiedMounts []Mount
7180
for _, m := range mounts {
7281
mount := m
73-
mount.Options = append(mount.Options, "noexec")
82+
mount.Options = ipcMountOptions
7483
modifiedMounts = append(modifiedMounts, mount)
7584
}
7685

internal/discover/ipc_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func TestIPCMounts(t *testing.T) {
4949
HostPath: "/host/path",
5050
Path: "/host/path",
5151
Options: []string{
52-
"ro",
5352
"nosuid",
5453
"nodev",
5554
"rbind",

0 commit comments

Comments
 (0)