diff options
author | Roberto Sassu <roberto.sassu@huawei.com> | 2023-06-10 09:57:37 +0200 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2023-07-10 13:59:38 -0400 |
commit | 6db7d1dee8003921b353d7e613471fe8995f46b5 (patch) | |
tree | cd4c88e6eb047849624f2d3bc7839bd551f6e687 /include/linux/evm.h | |
parent | baed456a6a2f6b8bec2913a6c6a72cc811252c6e (diff) | |
download | lwn-6db7d1dee8003921b353d7e613471fe8995f46b5.tar.gz lwn-6db7d1dee8003921b353d7e613471fe8995f46b5.zip |
evm: Align evm_inode_init_security() definition with LSM infrastructure
Change the evm_inode_init_security() definition to align with the LSM
infrastructure. Keep the existing behavior of including in the HMAC
calculation only the first xattr provided by LSMs.
Changing the evm_inode_init_security() definition requires passing the
xattr array allocated by security_inode_init_security(), and the number of
xattrs filled by previously invoked LSMs.
Use the newly introduced lsm_get_xattr_slot() to position EVM correctly in
the xattrs array, like a regular LSM, and to increment the number of filled
slots. For now, the LSM infrastructure allocates enough xattrs slots to
store the EVM xattr, without using the reservation mechanism.
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Acked-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'include/linux/evm.h')
-rw-r--r-- | include/linux/evm.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/linux/evm.h b/include/linux/evm.h index 7dc1ee74169f..01fc495a83e2 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h @@ -56,9 +56,10 @@ static inline void evm_inode_post_set_acl(struct dentry *dentry, { return evm_inode_post_setxattr(dentry, acl_name, NULL, 0); } -extern int evm_inode_init_security(struct inode *inode, - const struct xattr *xattr_array, - struct xattr *evm); + +int evm_inode_init_security(struct inode *inode, struct inode *dir, + const struct qstr *qstr, struct xattr *xattrs, + int *xattr_count); extern bool evm_revalidate_status(const char *xattr_name); extern int evm_protected_xattr_if_enabled(const char *req_xattr_name); extern int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer, @@ -157,9 +158,10 @@ static inline void evm_inode_post_set_acl(struct dentry *dentry, return; } -static inline int evm_inode_init_security(struct inode *inode, - const struct xattr *xattr_array, - struct xattr *evm) +static inline int evm_inode_init_security(struct inode *inode, struct inode *dir, + const struct qstr *qstr, + struct xattr *xattrs, + int *xattr_count) { return 0; } |