diff options
author | Roberto Sassu <roberto.sassu@huawei.com> | 2021-05-20 11:48:31 +0300 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2021-05-21 19:48:30 +0300 |
commit | 4a804b8a4572dfc81c3a59709d49ae206e4370ba (patch) | |
tree | cf4242a252556e45a32fa01aaa5afd59469bd9d8 /drivers/s390/crypto/zcrypt_debug.h | |
parent | e3ccfe1ad7d895487977ef64eda3441d16c9851a (diff) | |
download | linux-4a804b8a4572dfc81c3a59709d49ae206e4370ba.tar.xz |
evm: Introduce evm_hmac_disabled() to safely ignore verification errors
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, or
because the filesystem does not support them.
Unfortunately, EVM will deny any further metadata operation on new files,
as evm_protect_xattr() will return the INTEGRITY_NOLABEL error if protected
xattrs exist without security.evm, INTEGRITY_NOXATTRS if no protected
xattrs exist or INTEGRITY_UNKNOWN if xattrs are not supported. 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 introduces the evm_hmac_disabled() function to determine whether
or not it is safe to ignore verification errors, based on the ability of
EVM to calculate HMACs. If the HMAC key is not loaded, and it cannot be
loaded in the future due to the EVM_SETUP_COMPLETE initialization flag,
allowing an operation despite the attrs/xattrs being found invalid will not
make them valid.
Since the post hooks can be executed even when the HMAC key is not loaded,
this patch also ensures that the EVM_INIT_HMAC initialization flag is set
before the post hooks call evm_update_evmxattr().
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Suggested-by: Mimi Zohar <zohar@linux.ibm.com> (for ensuring EVM_INIT_HMAC is set)
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'drivers/s390/crypto/zcrypt_debug.h')
0 files changed, 0 insertions, 0 deletions