]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ima: Align ima_inode_setxattr() definition with LSM infrastructure
authorRoberto Sassu <roberto.sassu@huawei.com>
Thu, 15 Feb 2024 10:30:51 +0000 (11:30 +0100)
committerPaul Moore <paul@paul-moore.com>
Fri, 16 Feb 2024 04:43:39 +0000 (23:43 -0500)
Change ima_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/ima.h
security/integrity/ima/ima_appraise.c
security/security.c

index b66353f679e89bb352042cf4ca34cb2ab51fb4f9..077324309c113f10fbcc2076b5ad20374c3bcbed 100644 (file)
@@ -188,8 +188,9 @@ static inline void ima_post_key_create_or_update(struct key *keyring,
 extern bool is_ima_appraise_enabled(void);
 extern void ima_inode_post_setattr(struct mnt_idmap *idmap,
                                   struct dentry *dentry, int ia_valid);
-extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
-                      const void *xattr_value, size_t xattr_value_len);
+extern int ima_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
+                             const char *xattr_name, const void *xattr_value,
+                             size_t xattr_value_len, int flags);
 extern int ima_inode_set_acl(struct mnt_idmap *idmap,
                             struct dentry *dentry, const char *acl_name,
                             struct posix_acl *kacl);
@@ -212,10 +213,12 @@ static inline void ima_inode_post_setattr(struct mnt_idmap *idmap,
        return;
 }
 
-static inline int ima_inode_setxattr(struct dentry *dentry,
+static inline int ima_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)
 {
        return 0;
 }
index 36c2938a5c6935bd437160e9969dfffe4d688b2f..cb2d0d11aa774cd9649314036bdd86b035d37370 100644 (file)
@@ -750,8 +750,9 @@ static int validate_hash_algo(struct dentry *dentry,
        return -EACCES;
 }
 
-int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
-                      const void *xattr_value, size_t xattr_value_len)
+int ima_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
+                      const char *xattr_name, const void *xattr_value,
+                      size_t xattr_value_len, int flags)
 {
        const struct evm_ima_xattr_data *xvalue = xattr_value;
        int digsig = 0;
index 36933ac45d3bd6dfdf96ef72434dc28cdde0af6c..b4f6b7467e087103db2475320a7b5fedfb2b582b 100644 (file)
@@ -2269,7 +2269,7 @@ int security_inode_setxattr(struct mnt_idmap *idmap,
                ret = cap_inode_setxattr(dentry, name, value, size, flags);
        if (ret)
                return ret;
-       ret = ima_inode_setxattr(dentry, name, value, size);
+       ret = ima_inode_setxattr(idmap, dentry, name, value, size, flags);
        if (ret)
                return ret;
        return evm_inode_setxattr(idmap, dentry, name, value, size);