提交 dd2fe236 编写于 作者: R Roberto Sassu 提交者: Zheng Zengkai

evm: Reset status even when security.evm is modified

hulk inclusion
category: feature
feature: IMA Digest Lists extension
bugzilla: 46797

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

Without resetting the status when security.evm is modified, IMA appraisal
would continue to use the cached result and wouldn't detect whether the
meta_immutable requirement is still satisfied.

This patch calls evm_reset_status() in the post hooks when security.evm is
modified.
Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: NTianxing Zhang <zhangtianxing3@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d0a0340c
...@@ -211,7 +211,6 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, ...@@ -211,7 +211,6 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
evm_status = INTEGRITY_FAIL; evm_status = INTEGRITY_FAIL;
goto out; goto out;
} }
digest.hdr.algo = HASH_ALGO_SHA1; digest.hdr.algo = HASH_ALGO_SHA1;
rc = evm_calc_hmac(dentry, xattr_name, xattr_value, rc = evm_calc_hmac(dentry, xattr_name, xattr_value,
xattr_value_len, &digest); xattr_value_len, &digest);
...@@ -618,7 +617,8 @@ bool evm_status_revalidate(const char *xattr_name) ...@@ -618,7 +617,8 @@ bool evm_status_revalidate(const char *xattr_name)
if (!xattr_name) if (!xattr_name)
return true; return true;
if (!evm_protected_xattr(xattr_name) && !posix_xattr_acl(xattr_name)) if (!evm_protected_xattr(xattr_name) && !posix_xattr_acl(xattr_name) &&
strcmp(xattr_name, XATTR_NAME_EVM))
return false; return false;
return true; return true;
...@@ -645,6 +645,9 @@ void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name, ...@@ -645,6 +645,9 @@ void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name,
evm_reset_status(dentry->d_inode); evm_reset_status(dentry->d_inode);
if (!strcmp(xattr_name, XATTR_NAME_EVM))
return;
evm_update_evmxattr(dentry, xattr_name, xattr_value, xattr_value_len); evm_update_evmxattr(dentry, xattr_name, xattr_value, xattr_value_len);
} }
...@@ -665,6 +668,9 @@ void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) ...@@ -665,6 +668,9 @@ void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name)
evm_reset_status(dentry->d_inode); evm_reset_status(dentry->d_inode);
if (!strcmp(xattr_name, XATTR_NAME_EVM))
return;
evm_update_evmxattr(dentry, xattr_name, NULL, 0); evm_update_evmxattr(dentry, xattr_name, NULL, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册