evm: Align evm_inode_setxattr() definition with LSM infrastructure
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 15 Feb 2024 10:30:55 +0000 (11:30 +0100)
committerPaul Moore <paul@paul-moore.com>
Fri, 16 Feb 2024 04:43:40 +0000 (23:43 -0500)
Change evm_inode_setxattr() definition, so that it can be registered as
implementation of the inode_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 5cc3863..7de24c1 100644 (file)
@@ -27,7 +27,7 @@ extern void evm_inode_post_setattr(struct mnt_idmap *idmap,
                                   struct dentry *dentry, int ia_valid);
 extern int evm_inode_setxattr(struct mnt_idmap *idmap,
                              struct dentry *dentry, const char *name,
-                             const void *value, size_t size);
+                             const void *value, size_t size, int flags);
 extern void evm_inode_post_setxattr(struct dentry *dentry,
                                    const char *xattr_name,
                                    const void *xattr_value,
@@ -107,7 +107,7 @@ static inline void evm_inode_post_setattr(struct mnt_idmap *idmap,
 
 static inline int evm_inode_setxattr(struct mnt_idmap *idmap,
                                     struct dentry *dentry, const char *name,
-                                    const void *value, size_t size)
+                                    const void *value, size_t size, int flags)
 {
        return 0;
 }
index ac34f21..12ba320 100644 (file)
@@ -581,6 +581,7 @@ out:
  * @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
  *
  * Before allowing the 'security.evm' protected xattr to be updated,
  * verify the existing value is valid.  As only the kernel should have
@@ -590,7 +591,7 @@ out:
  */
 int evm_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
                       const char *xattr_name, const void *xattr_value,
-                      size_t xattr_value_len)
+                      size_t xattr_value_len, int flags)
 {
        const struct evm_ima_xattr_data *xattr_data = xattr_value;
 
index 58e2036..b99c9a6 100644 (file)
@@ -2272,7 +2272,7 @@ int security_inode_setxattr(struct mnt_idmap *idmap,
        ret = ima_inode_setxattr(idmap, dentry, name, value, size, flags);
        if (ret)
                return ret;
-       return evm_inode_setxattr(idmap, dentry, name, value, size);
+       return evm_inode_setxattr(idmap, dentry, name, value, size, flags);
 }
 
 /**