From 7052d21dc45be8ba5ba82117aedc0cb6ecb7c1b7 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 25 Jul 2019 16:47:32 -0700 Subject: Automated rollback of changelist 255679453 PiperOrigin-RevId: 260047477 --- runsc/boot/fs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runsc/boot/fs.go') 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) } -- cgit v1.2.3