Skip to content
Snippets Groups Projects
Commit 192b51c2 authored by Roberto Sassu's avatar Roberto Sassu Committed by Yongqiang Liu
Browse files

evm: Check size of security.evm before using it

stable inclusion
from stable-v4.19.155
commit 05f703b07727c0eb81f487143b583d5f8561d900
category: bugfix
bugzilla: 83797, https://gitee.com/openeuler/kernel/issues/I5047U


CVE: NA

-----------------------------------------------------------------

commit 455b6c91 upstream.

This patch checks the size for the EVM_IMA_XATTR_DIGSIG and
EVM_XATTR_PORTABLE_DIGSIG types to ensure that the algorithm is read from
the buffer returned by vfs_getxattr_alloc().

Cc: stable@vger.kernel.org # 4.19.x
Fixes: 5feeb611 ("evm: Allow non-SHA1 digital signatures")
Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWang Weiyang <wangweiyang2@huawei.com>
Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 93dfedd1
No related branches found
No related tags found
No related merge requests found
...@@ -190,6 +190,12 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, ...@@ -190,6 +190,12 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
break; break;
case EVM_IMA_XATTR_DIGSIG: case EVM_IMA_XATTR_DIGSIG:
case EVM_XATTR_PORTABLE_DIGSIG: case EVM_XATTR_PORTABLE_DIGSIG:
/* accept xattr with non-empty signature field */
if (xattr_len <= sizeof(struct signature_v2_hdr)) {
evm_status = INTEGRITY_FAIL;
goto out;
}
hdr = (struct signature_v2_hdr *)xattr_data; hdr = (struct signature_v2_hdr *)xattr_data;
digest.hdr.algo = hdr->hash_algo; digest.hdr.algo = hdr->hash_algo;
rc = evm_calc_hash(dentry, xattr_name, xattr_value, rc = evm_calc_hash(dentry, xattr_name, xattr_value,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment