summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd/chroot.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-07-03 01:20:37 +0000
committergVisor bot <gvisor-bot@google.com>2021-07-03 01:20:37 +0000
commit7775d6b74f3aedfed8f174b4fc1f64966c1dd05e (patch)
tree798a458b4aa85f19d62bf38280575c398c55572d /runsc/cmd/chroot.go
parent05c568f4da3336d05e17d38a2ce15cab3be729e1 (diff)
parent3d32a05a35bde4cfed861c274c32bfc55acc19c9 (diff)
Merge release-20210628.0-23-g3d32a05a3 (automated)
Diffstat (limited to 'runsc/cmd/chroot.go')
-rw-r--r--runsc/cmd/chroot.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/runsc/cmd/chroot.go b/runsc/cmd/chroot.go
index e988247da..791a50135 100644
--- a/runsc/cmd/chroot.go
+++ b/runsc/cmd/chroot.go
@@ -30,7 +30,7 @@ func mountInChroot(chroot, src, dst, typ string, flags uint32) error {
chrootDst := filepath.Join(chroot, dst)
log.Infof("Mounting %q at %q", src, chrootDst)
- if err := specutils.Mount(src, chrootDst, typ, flags); err != nil {
+ if err := specutils.Mount(src, chrootDst, typ, flags, "/proc"); err != nil {
return fmt.Errorf("error mounting %q at %q: %v", src, chrootDst, err)
}
return nil
@@ -70,11 +70,11 @@ func setUpChroot(pidns bool) error {
// Convert all shared mounts into slave to be sure that nothing will be
// propagated outside of our namespace.
- if err := unix.Mount("", "/", "", unix.MS_SLAVE|unix.MS_REC, ""); err != nil {
+ if err := specutils.SafeMount("", "/", "", unix.MS_SLAVE|unix.MS_REC, "", "/proc"); err != nil {
return fmt.Errorf("error converting mounts: %v", err)
}
- if err := unix.Mount("runsc-root", chroot, "tmpfs", unix.MS_NOSUID|unix.MS_NODEV|unix.MS_NOEXEC, ""); err != nil {
+ if err := specutils.SafeMount("runsc-root", chroot, "tmpfs", unix.MS_NOSUID|unix.MS_NODEV|unix.MS_NOEXEC, "", "/proc"); err != nil {
return fmt.Errorf("error mounting tmpfs in choot: %v", err)
}
@@ -89,7 +89,7 @@ func setUpChroot(pidns bool) error {
}
}
- if err := unix.Mount("", chroot, "", unix.MS_REMOUNT|unix.MS_RDONLY|unix.MS_BIND, ""); err != nil {
+ if err := specutils.SafeMount("", chroot, "", unix.MS_REMOUNT|unix.MS_RDONLY|unix.MS_BIND, "", "/proc"); err != nil {
return fmt.Errorf("error remounting chroot in read-only: %v", err)
}