Skip to content

Commit 2563d17

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 e436533 commit 2563d17

File tree

8 files changed

+19
-12
lines changed

8 files changed

+19
-12
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ containerEdits:
9494
- ro
9595
- nosuid
9696
- nodev
97-
- bind
97+
- rbind
98+
- rprivate
9899
devices:
99100
- containerEdits:
100101
deviceNodes:

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ containerEdits:
9999
- ro
100100
- nosuid
101101
- nodev
102-
- bind
102+
- rbind
103+
- rprivate
103104
devices:
104105
- containerEdits:
105106
deviceNodes:

internal/discover/ipc_test.go

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ func (d *mounts) Mounts() ([]Mount, error) {
102102
"ro",
103103
"nosuid",
104104
"nodev",
105-
"bind",
105+
"rbind",
106+
"rprivate",
106107
},
107108
}
108109
}

internal/discover/mounts_test.go

Lines changed: 2 additions & 1 deletion
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

Lines changed: 5 additions & 5 deletions
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)