• Alexander Larsson's avatar
    ovl: Validate verity xattr when resolving lowerdata · 184996e9
    Alexander Larsson authored
    The new digest field in the metacopy xattr is used during lookup to
    record whether the header contained a digest in the OVL_HAS_DIGEST
    flags.
    
    When accessing file data the first time, if OVL_HAS_DIGEST is set, we
    reload the metadata and check that the source lowerdata inode matches
    the specified digest in it (according to the enabled verity
    options). If the verity check passes we store this info in the inode
    flags as OVL_VERIFIED_DIGEST, so that we can avoid doing it again if
    the inode remains in memory.
    
    The verification is done in ovl_maybe_validate_verity() which needs to
    be called in the same places as ovl_maybe_lookup_lowerdata(), so there
    is a new ovl_verify_lowerdata() helper that calls these in the right
    order, and all current callers of ovl_maybe_lookup_lowerdata() are
    changed to call it instead.
    Signed-off-by: default avatarAlexander Larsson <alexl@redhat.com>
    Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    184996e9
super.c 38.5 KB