Skip to content

Commit 9f4ef6a

Browse files
robertosassugregkh
authored andcommitted
evm: Check size of security.evm before using it
commit 455b6c9112eff8d249e32ba165742085678a80a4 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: 5feeb61 ("evm: Allow non-SHA1 digital signatures") Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a42b127 commit 9f4ef6a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

security/integrity/evm/evm_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
181181
break;
182182
case EVM_IMA_XATTR_DIGSIG:
183183
case EVM_XATTR_PORTABLE_DIGSIG:
184+
/* accept xattr with non-empty signature field */
185+
if (xattr_len <= sizeof(struct signature_v2_hdr)) {
186+
evm_status = INTEGRITY_FAIL;
187+
goto out;
188+
}
189+
184190
hdr = (struct signature_v2_hdr *)xattr_data;
185191
digest.hdr.algo = hdr->hash_algo;
186192
rc = evm_calc_hash(dentry, xattr_name, xattr_value,

0 commit comments

Comments
 (0)