Set root dentry and hash for verity before verify
Set root dentry and root hash in verity fs before we verify the root directory if a root hash is provided. These are used during verification. PiperOrigin-RevId: 367547346
This commit is contained in:
parent
496a3654e7
commit
edf30a9bc5
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue