You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bind mounts of filesystems with certain options set
Currently bind mounts of filesystems with nodev, nosuid, noexec,
noatime, relatime, strictatime, nodiratime options set fail in rootless
mode if the same options are not set for the bind mount.
For ro filesystems this was resolved by #2570 by remounting again
with ro set.
Follow the same approach for nodev, nosuid, noexec, noatime, relatime,
strictatime, nodiratime but allow to revert back to the old behaviour
via the new `--no-mount-fallback` command line option.
Add a testcase to verify that bind mounts of filesystems with nodev,
nosuid, noexec, noatime options set work in rootless mode.
Add a testcase that mounts a nodev, nosuid, noexec, noatime filesystem
with a ro flag.
Add two further testcases that ensure that the above testcases would
fail if the `--no-mount-fallback` command line option is set.
* contrib/completions/bash/runc:
Add `--no-mount-fallback` command line option for bash completion.
* create.go:
Add `--no-mount-fallback` command line option.
* restore.go:
Add `--no-mount-fallback` command line option.
* run.go:
Add `--no-mount-fallback` command line option.
* libcontainer/configs/config.go:
Add `NoMountFallback` field to the `Config` struct to store
the command line option value.
* libcontainer/specconv/spec_linux.go:
Add `NoMountFallback` field to the `CreateOpts` struct to store
the command line option value and store it in the libcontainer
config.
* utils_linux.go:
Store the command line option value in the `CreateOpts` struct.
* libcontainer/rootfs_linux.go:
In case that `--no-mount-fallback` is not set try to remount the
bind filesystem again with the options nodev, nosuid, noexec,
noatime, relatime, strictatime or nodiratime if they are set on
the source filesystem.
* tests/integration/mounts_sshfs.bats:
Add testcases and rework sshfs setup to allow specifying
different mount options depending on the test case.
Signed-off-by: Ruediger Pluem <[email protected]>
Copy file name to clipboardExpand all lines: create.go
+4
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,10 @@ command(s) that get executed on start, edit the args parameter of the spec. See
51
51
Name: "preserve-fds",
52
52
Usage: "Pass N additional file descriptors to the container (stdio + $LISTEN_FDS + N in total)",
53
53
},
54
+
cli.BoolFlag{
55
+
Name: "no-mount-fallback",
56
+
Usage: "Do not fallback when the specific configuration is not applicable (e.g., do not try to remount a bind mount again after the first attempt failed on source filesystems that have nodev, noexec, nosuid, noatime, relatime, strictatime, nodiratime set)",
Copy file name to clipboardExpand all lines: restore.go
+4
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,10 @@ using the runc checkpoint command.`,
98
98
Value: "",
99
99
Usage: "Specify an LSM mount context to be used during restore.",
100
100
},
101
+
cli.BoolFlag{
102
+
Name: "no-mount-fallback",
103
+
Usage: "Do not fallback when the specific configuration is not applicable (e.g., do not try to remount a bind mount again after the first attempt failed on source filesystems that have nodev, noexec, nosuid, noatime, relatime, strictatime, nodiratime set)",
Copy file name to clipboardExpand all lines: run.go
+4
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,10 @@ command(s) that get executed on start, edit the args parameter of the spec. See
64
64
Name: "preserve-fds",
65
65
Usage: "Pass N additional file descriptors to the container (stdio + $LISTEN_FDS + N in total)",
66
66
},
67
+
cli.BoolFlag{
68
+
Name: "no-mount-fallback",
69
+
Usage: "Do not fallback when the specific configuration is not applicable (e.g., do not try to remount a bind mount again after the first attempt failed on source filesystems that have nodev, noexec, nosuid, noatime, relatime, strictatime, nodiratime set)",
0 commit comments