diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-14 16:40:36 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-14 16:40:36 +0000 |
commit | 0a45ce1d0302039bef819474a5ab7b3e3f68729d (patch) | |
tree | c7e13090ff423dda11351acf10d699de4a22c647 /pkg/sentry/fsimpl/tmpfs/filesystem.go | |
parent | ed3c3a576051d9aef718f578bb1c2cbf268b5251 (diff) | |
parent | 47dfba76616a69887f0d5a4be6eb82b5dc5d0f52 (diff) |
Merge release-20200422.0-303-g47dfba7 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/tmpfs/filesystem.go')
-rwxr-xr-x | pkg/sentry/fsimpl/tmpfs/filesystem.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/filesystem.go b/pkg/sentry/fsimpl/tmpfs/filesystem.go index e0ad82769..80fa7b29d 100755 --- a/pkg/sentry/fsimpl/tmpfs/filesystem.go +++ b/pkg/sentry/fsimpl/tmpfs/filesystem.go @@ -772,5 +772,24 @@ func (fs *filesystem) RemovexattrAt(ctx context.Context, rp *vfs.ResolvingPath, func (fs *filesystem) PrependPath(ctx context.Context, vfsroot, vd vfs.VirtualDentry, b *fspath.Builder) error { fs.mu.RLock() defer fs.mu.RUnlock() - return genericPrependPath(vfsroot, vd.Mount(), vd.Dentry().Impl().(*dentry), b) + mnt := vd.Mount() + d := vd.Dentry().Impl().(*dentry) + for { + if mnt == vfsroot.Mount() && &d.vfsd == vfsroot.Dentry() { + return vfs.PrependPathAtVFSRootError{} + } + if &d.vfsd == mnt.Root() { + return nil + } + if d.parent == nil { + if d.name != "" { + // This must be an anonymous memfd file. + b.PrependComponent("/" + d.name) + return vfs.PrependPathSyntheticError{} + } + return vfs.PrependPathAtNonMountRootError{} + } + b.PrependComponent(d.name) + d = d.parent + } } |