]> www.infradead.org Git - users/hch/configfs.git/commitdiff
evm: Align evm_inode_post_setxattr() definition with LSM infrastructure
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 15 Feb 2024 10:30:56 +0000 (11:30 +0100)
committerPaul Moore <paul@paul-moore.com>
Fri, 16 Feb 2024 04:43:41 +0000 (23:43 -0500)
Change evm_inode_post_setxattr() definition, so that it can be registered
as implementation of the inode_post_setxattr hook.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
include/linux/evm.h
security/integrity/evm/evm_main.c
security/security.c

index 7de24c1ada900715d42633836d8134a3ee1ba13a..3faabdd478521e7550f90401bf747c99a13eca7c 100644 (file)
@@ -31,7 +31,8 @@ extern int evm_inode_setxattr(struct mnt_idmap *idmap,
 extern void evm_inode_post_setxattr(struct dentry *dentry,
                                    const char *xattr_name,
                                    const void *xattr_value,
-                                   size_t xattr_value_len);
+                                   size_t xattr_value_len,
+                                   int flags);
 extern int evm_inode_copy_up_xattr(const char *name);
 extern int evm_inode_removexattr(struct mnt_idmap *idmap,
                                 struct dentry *dentry, const char *xattr_name);
@@ -56,7 +57,7 @@ static inline void evm_inode_post_set_acl(struct dentry *dentry,
                                          const char *acl_name,
                                          struct posix_acl *kacl)
 {
-       return evm_inode_post_setxattr(dentry, acl_name, NULL, 0);
+       return evm_inode_post_setxattr(dentry, acl_name, NULL, 0, 0);
 }
 
 int evm_inode_init_security(struct inode *inode, struct inode *dir,
@@ -115,7 +116,8 @@ static inline int evm_inode_setxattr(struct mnt_idmap *idmap,
 static inline void evm_inode_post_setxattr(struct dentry *dentry,
                                           const char *xattr_name,
                                           const void *xattr_value,
-                                          size_t xattr_value_len)
+                                          size_t xattr_value_len,
+                                          int flags)
 {
        return;
 }
index 12ba3207fd316831dad5a901b02dd9cb7539af32..d351431796991e3dfbb416f12f4fb011d72fb630 100644 (file)
@@ -753,6 +753,7 @@ bool evm_revalidate_status(const char *xattr_name)
  * @xattr_name: pointer to the affected extended attribute name
  * @xattr_value: pointer to the new extended attribute value
  * @xattr_value_len: pointer to the new extended attribute value length
+ * @flags: flags to pass into filesystem operations
  *
  * Update the HMAC stored in 'security.evm' to reflect the change.
  *
@@ -761,7 +762,8 @@ bool evm_revalidate_status(const char *xattr_name)
  * i_mutex lock.
  */
 void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name,
-                            const void *xattr_value, size_t xattr_value_len)
+                            const void *xattr_value, size_t xattr_value_len,
+                            int flags)
 {
        if (!evm_revalidate_status(xattr_name))
                return;
index b99c9a69d4c2b390bac89d1ee42b030e85efde34..dc188201a4f58cd3cf4b6e066df167275b69458d 100644 (file)
@@ -2367,7 +2367,7 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name,
        if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
                return;
        call_void_hook(inode_post_setxattr, dentry, name, value, size, flags);
-       evm_inode_post_setxattr(dentry, name, value, size);
+       evm_inode_post_setxattr(dentry, name, value, size, flags);
 }
 
 /**