• R
    evm: Ignore INTEGRITY_NOLABEL/INTEGRITY_NOXATTRS if conditions are safe · f74c413c
    Roberto Sassu 提交于
    hulk inclusion
    category: feature
    feature: IMA Digest Lists extension
    bugzilla: 46797
    
    ---------------------------
    
    When a file is being created, LSMs can set the initial label with the
    inode_init_security hook. If no HMAC key is loaded, the new file will have
    LSM xattrs but not the HMAC. It is also possible that the file remains
    without protected xattrs after creation if no active LSM provided it.
    
    Unfortunately, EVM will deny any further metadata operation on new files,
    as evm_protect_xattr() will always return the INTEGRITY_NOLABEL error, or
    INTEGRITY_NOXATTRS if no protected xattrs exist. This would limit the
    usability of EVM when only a public key is loaded, as commands such as cp
    or tar with the option to preserve xattrs won't work.
    
    This patch ignores these errors when they won't be an issue, if no HMAC key
    is loaded and cannot be loaded in the future (which can be enforced by
    setting the EVM_SETUP_COMPLETE initialization flag).
    Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
    Reviewed-by: NJason Yan <yanaijie@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    f74c413c
evm_main.c 17.0 KB