Skip to content

Commit 3eb92b0

Browse files
authored
Merge pull request #1594 from NVIDIA/backport-1593-to-release-1.18
[release-1.18] Ensure that IPC sockets are not mounted read-only
2 parents 7e0d63a + 43c865f commit 3eb92b0

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)