diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-04-09 01:37:33 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-09 01:37:33 +0000 |
commit | 1beca999f271a677c7c821e259f46c8db875c2d9 (patch) | |
tree | 1758b6972b60d103fd0f8996e4547e79a07d2fb8 /pkg/sentry/fsimpl/verity | |
parent | 983fc7860c0644fbcfc1eaa1ad301837612e6187 (diff) | |
parent | edf30a9bc5a645a7e03fca81f3e5852214588021 (diff) |
Merge release-20210408.0-9-gedf30a9bc (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/verity')
-rw-r--r-- | pkg/sentry/fsimpl/verity/verity.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/sentry/fsimpl/verity/verity.go b/pkg/sentry/fsimpl/verity/verity.go index 6d6e0e77a..06f2c211c 100644 --- a/pkg/sentry/fsimpl/verity/verity.go +++ b/pkg/sentry/fsimpl/verity/verity.go @@ -428,9 +428,15 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt d.mode = uint32(stat.Mode) d.uid = stat.UID d.gid = stat.GID - d.hash = make([]byte, len(rootHash)) d.childrenNames = make(map[string]struct{}) + d.hashMu.Lock() + d.hash = make([]byte, len(rootHash)) + copy(d.hash, rootHash) + d.hashMu.Unlock() + + fs.rootDentry = d + if !d.isDir() { ctx.Warningf("verity root must be a directory") return nil, nil, syserror.EINVAL @@ -502,13 +508,8 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt } } - d.hashMu.Lock() - copy(d.hash, rootHash) - d.hashMu.Unlock() d.vfsd.Init(d) - fs.rootDentry = d - return &fs.vfsfs, &d.vfsd, nil } |