summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-25 23:57:55 +0000
committergVisor bot <gvisor-bot@google.com>2019-07-25 23:57:55 +0000
commitd1ac010e93da039b4a046981845adf6f11273b3d (patch)
tree620634d4e99e7f03cced1b07f5784b7c2f8ca7f9 /runsc
parent3196ae04b801ad8ab44980e4f72ce57528fe89ea (diff)
parent7052d21dc45be8ba5ba82117aedc0cb6ecb7c1b7 (diff)
Merge 7052d21d (automated)
Diffstat (limited to 'runsc')
-rw-r--r--runsc/boot/fs.go13
1 files changed, 13 insertions, 0 deletions
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)
}