aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/integrity/evm/evm_main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
index 73baf7168843..3bcb80df4d01 100644
--- a/security/integrity/evm/evm_main.c
+++ b/security/integrity/evm/evm_main.c
@@ -300,12 +300,20 @@ out:
300 * @xattr_value: pointer to the new extended attribute value 300 * @xattr_value: pointer to the new extended attribute value
301 * @xattr_value_len: pointer to the new extended attribute value length 301 * @xattr_value_len: pointer to the new extended attribute value length
302 * 302 *
303 * Updating 'security.evm' requires CAP_SYS_ADMIN privileges and that 303 * Before allowing the 'security.evm' protected xattr to be updated,
304 * the current value is valid. 304 * verify the existing value is valid. As only the kernel should have
305 * access to the EVM encrypted key needed to calculate the HMAC, prevent
306 * userspace from writing HMAC value. Writing 'security.evm' requires
307 * requires CAP_SYS_ADMIN privileges.
305 */ 308 */
306int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name, 309int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name,
307 const void *xattr_value, size_t xattr_value_len) 310 const void *xattr_value, size_t xattr_value_len)
308{ 311{
312 const struct evm_ima_xattr_data *xattr_data = xattr_value;
313
314 if ((strcmp(xattr_name, XATTR_NAME_EVM) == 0)
315 && (xattr_data->type == EVM_XATTR_HMAC))
316 return -EPERM;
309 return evm_protect_xattr(dentry, xattr_name, xattr_value, 317 return evm_protect_xattr(dentry, xattr_name, xattr_value,
310 xattr_value_len); 318 xattr_value_len);
311} 319}