summaryrefslogtreecommitdiffhomepage
path: root/runsc/specutils
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-05-04 21:40:47 +0000
committergVisor bot <gvisor-bot@google.com>2021-05-04 21:40:47 +0000
commite6e0c2b01201293e0b570234819bc1801559d7ec (patch)
treefe8bd1c061a97881808d3e52e3f4e63e19149dd4 /runsc/specutils
parentc5ddb78278ba13dc3d1a20cec27a57df7b42135d (diff)
parent95df852bf283bf5eb173cc92b14d487b2367a8a7 (diff)
Merge release-20210419.0-60-g95df852bf (automated)
Diffstat (limited to 'runsc/specutils')
-rw-r--r--runsc/specutils/specutils.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go
index e5e66546c..11b476690 100644
--- a/runsc/specutils/specutils.go
+++ b/runsc/specutils/specutils.go
@@ -335,9 +335,27 @@ func capsFromNames(names []string, skipSet map[linux.Capability]struct{}) (auth.
// Is9PMount returns true if the given mount can be mounted as an external
// gofer.
func Is9PMount(m specs.Mount, vfs2Enabled bool) bool {
+ MaybeConvertToBindMount(&m)
return m.Type == "bind" && m.Source != "" && IsSupportedDevMount(m, vfs2Enabled)
}
+// MaybeConvertToBindMount converts mount type to "bind" in case any of the
+// mount options are either "bind" or "rbind" as required by the OCI spec.
+//
+// "For bind mounts (when options include either bind or rbind), the type is a
+// dummy, often "none" (not listed in /proc/filesystems)."
+func MaybeConvertToBindMount(m *specs.Mount) {
+ if m.Type == "bind" {
+ return
+ }
+ for _, opt := range m.Options {
+ if opt == "bind" || opt == "rbind" {
+ m.Type = "bind"
+ return
+ }
+ }
+}
+
// IsSupportedDevMount returns true if m.Destination does not specify a
// path that is hardcoded by VFS1's implementation of /dev.
func IsSupportedDevMount(m specs.Mount, vfs2Enabled bool) bool {