diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-07-25 16:47:32 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-25 16:48:49 -0700 |
commit | 7052d21dc45be8ba5ba82117aedc0cb6ecb7c1b7 (patch) | |
tree | a6bc96ead7b986862bf3995312339c9435fcb5e7 | |
parent | 83767574951f8ab4727070741451991ba848f6a6 (diff) |
Automated rollback of changelist 255679453
PiperOrigin-RevId: 260047477
-rw-r--r-- | pkg/sentry/fs/inode_overlay.go | 6 | ||||
-rw-r--r-- | runsc/boot/fs.go | 13 | ||||
-rw-r--r-- | test/syscalls/BUILD | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/pkg/sentry/fs/inode_overlay.go b/pkg/sentry/fs/inode_overlay.go index e0602da17..246b97161 100644 --- a/pkg/sentry/fs/inode_overlay.go +++ b/pkg/sentry/fs/inode_overlay.go @@ -571,12 +571,6 @@ func overlayCheck(ctx context.Context, o *overlayEntry, p PermMask) error { if o.upper != nil { err = o.upper.check(ctx, p) } else { - if p.Write { - // Since writes will be redirected to the upper filesystem, the lower - // filesystem need not be writable, but must be readable for copy-up. - p.Write = false - p.Read = true - } err = o.lower.check(ctx, p) } o.copyMu.RUnlock() diff --git a/runsc/boot/fs.go b/runsc/boot/fs.go index 55bfc27ff..aaad0121b 100644 --- a/runsc/boot/fs.go +++ b/runsc/boot/fs.go @@ -81,6 +81,19 @@ func addOverlay(ctx context.Context, conf *Config, lower *fs.Inode, name string, if err != nil { return nil, fmt.Errorf("creating tmpfs overlay: %v", err) } + + // Replicate permissions and owner from lower to upper mount point. + attr, err := lower.UnstableAttr(ctx) + if err != nil { + return nil, fmt.Errorf("reading attributes from lower mount point: %v", err) + } + if !upper.InodeOperations.SetPermissions(ctx, upper, attr.Perms) { + return nil, fmt.Errorf("error setting permission to upper mount point") + } + if err := upper.InodeOperations.SetOwner(ctx, upper, attr.Owner); err != nil { + return nil, fmt.Errorf("setting owner to upper mount point: %v", err) + } + return fs.NewOverlayRoot(ctx, upper, lower, upperFlags) } diff --git a/test/syscalls/BUILD b/test/syscalls/BUILD index c54d90a1c..841a0f2e1 100644 --- a/test/syscalls/BUILD +++ b/test/syscalls/BUILD @@ -240,7 +240,7 @@ syscall_test( syscall_test(test = "//test/syscalls/linux:munmap_test") syscall_test( - add_overlay = False, # TODO(gvisor.dev/issue/316): enable when fixed. + add_overlay = True, test = "//test/syscalls/linux:open_create_test", ) |