Skip to content

Commit d0103aa

Browse files
committed
Add rprivate to CDI mount options
This ensures that mount propagation is set to rprivate for mounts from the host into the container. This aligns with the default in docker. Signed-off-by: Evan Lezar <[email protected]>
1 parent adb5e67 commit d0103aa

File tree

8 files changed

+19
-12
lines changed

8 files changed

+19
-12
lines changed

cmd/nvidia-ctk-installer/toolkit/toolkit_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ containerEdits:
109109
- ro
110110
- nosuid
111111
- nodev
112-
- bind
112+
- rbind
113+
- rprivate
113114
`,
114115
},
115116
}

cmd/nvidia-ctk/cdi/generate/generate_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ containerEdits:
111111
- ro
112112
- nosuid
113113
- nodev
114-
- bind
114+
- rbind
115+
- rprivate
115116
`,
116117
},
117118
}

internal/discover/ipc_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ func TestIPCMounts(t *testing.T) {
5252
"ro",
5353
"nosuid",
5454
"nodev",
55-
"bind",
55+
"rbind",
56+
"rprivate",
5657
"noexec",
5758
},
5859
},

internal/discover/mounts-to-container-path.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ func (d *mountsToContainerPath) Mounts() ([]Mount, error) {
7171
"ro",
7272
"nosuid",
7373
"nodev",
74-
"bind",
74+
"rbind",
75+
"rprivate",
7576
},
7677
}
7778
mounts = append(mounts, mount)

internal/discover/mounts-to-container-path_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ func TestMountsToContainerPath(t *testing.T) {
3232
"ro",
3333
"nosuid",
3434
"nodev",
35-
"bind",
35+
"rbind",
36+
"rprivate",
3637
}
3738

3839
testCases := []struct {

internal/discover/mounts.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ func (d *mounts) Mounts() ([]Mount, error) {
9090
"ro",
9191
"nosuid",
9292
"nodev",
93-
"bind",
93+
"rbind",
94+
"rprivate",
9495
},
9596
}
9697
}

internal/discover/mounts_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ func TestMounts(t *testing.T) {
4141
"ro",
4242
"nosuid",
4343
"nodev",
44-
"bind",
44+
"rbind",
45+
"rprivate",
4546
}
4647

4748
logger, logHook := testlog.NewNullLogger()

internal/platform-support/tegra/csv_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ func TestDiscovererFromCSVFiles(t *testing.T) {
7979
{
8080
Path: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
8181
HostPath: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
82-
Options: []string{"ro", "nosuid", "nodev", "bind"},
82+
Options: []string{"ro", "nosuid", "nodev", "rbind", "rprivate"},
8383
},
8484
{
8585
Path: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
8686
HostPath: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
87-
Options: []string{"ro", "nosuid", "nodev", "bind"},
87+
Options: []string{"ro", "nosuid", "nodev", "rbind", "rprivate"},
8888
},
8989
},
9090
expectedHooks: []discover.Hook{
@@ -135,12 +135,12 @@ func TestDiscovererFromCSVFiles(t *testing.T) {
135135
{
136136
Path: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
137137
HostPath: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
138-
Options: []string{"ro", "nosuid", "nodev", "bind"},
138+
Options: []string{"ro", "nosuid", "nodev", "rbind", "rprivate"},
139139
},
140140
{
141141
Path: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
142142
HostPath: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
143-
Options: []string{"ro", "nosuid", "nodev", "bind"},
143+
Options: []string{"ro", "nosuid", "nodev", "rbind", "rprivate"},
144144
},
145145
},
146146
expectedHooks: []discover.Hook{
@@ -175,7 +175,7 @@ func TestDiscovererFromCSVFiles(t *testing.T) {
175175
{
176176
Path: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
177177
HostPath: "/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so",
178-
Options: []string{"ro", "nosuid", "nodev", "bind"},
178+
Options: []string{"ro", "nosuid", "nodev", "rbind", "rprivate"},
179179
},
180180
},
181181
},

0 commit comments

Comments
 (0)