Skip to content

Commit 40ca4ee

Browse files
committed
evm: don't copy up 'security.evm' xattr
The security.evm HMAC and the original file signatures contain filesystem specific data. As a result, the HMAC and signature are not the same on the stacked and backing filesystems. Don't copy up 'security.evm'. Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 4e8daa7 commit 40ca4ee

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

include/linux/evm.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extern void evm_inode_post_setxattr(struct dentry *dentry,
3131
const char *xattr_name,
3232
const void *xattr_value,
3333
size_t xattr_value_len);
34+
extern int evm_inode_copy_up_xattr(const char *name);
3435
extern int evm_inode_removexattr(struct mnt_idmap *idmap,
3536
struct dentry *dentry, const char *xattr_name);
3637
extern void evm_inode_post_removexattr(struct dentry *dentry,
@@ -117,6 +118,11 @@ static inline void evm_inode_post_setxattr(struct dentry *dentry,
117118
return;
118119
}
119120

121+
static inline int evm_inode_copy_up_xattr(const char *name)
122+
{
123+
return 0;
124+
}
125+
120126
static inline int evm_inode_removexattr(struct mnt_idmap *idmap,
121127
struct dentry *dentry,
122128
const char *xattr_name)

security/integrity/evm/evm_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,13 @@ void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
863863
evm_update_evmxattr(dentry, NULL, NULL, 0);
864864
}
865865

866+
int evm_inode_copy_up_xattr(const char *name)
867+
{
868+
if (strcmp(name, XATTR_NAME_EVM) == 0)
869+
return 1; /* Discard */
870+
return -EOPNOTSUPP;
871+
}
872+
866873
/*
867874
* evm_inode_init_security - initializes security.evm HMAC value
868875
*/

security/security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2539,7 +2539,7 @@ int security_inode_copy_up_xattr(const char *name)
25392539
return rc;
25402540
}
25412541

2542-
return LSM_RET_DEFAULT(inode_copy_up_xattr);
2542+
return evm_inode_copy_up_xattr(name);
25432543
}
25442544
EXPORT_SYMBOL(security_inode_copy_up_xattr);
25452545

0 commit comments

Comments
 (0)