Skip to content

Commit bad5247

Browse files
robertosassupcmoore
authored andcommitted
ima: Align ima_inode_post_setattr() definition with LSM infrastructure
Change ima_inode_post_setattr() definition, so that it can be registered as implementation of the inode_post_setattr hook (to be introduced). Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Casey Schaufler <casey@schaufler-ca.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>
1 parent 54be6c6 commit bad5247

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

fs/attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ int notify_change(struct mnt_idmap *idmap, struct dentry *dentry,
502502

503503
if (!error) {
504504
fsnotify_change(dentry, ia_valid);
505-
ima_inode_post_setattr(idmap, dentry);
505+
ima_inode_post_setattr(idmap, dentry, ia_valid);
506506
evm_inode_post_setattr(dentry, ia_valid);
507507
}
508508

include/linux/ima.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static inline void ima_post_key_create_or_update(struct key *keyring,
186186
#ifdef CONFIG_IMA_APPRAISE
187187
extern bool is_ima_appraise_enabled(void);
188188
extern void ima_inode_post_setattr(struct mnt_idmap *idmap,
189-
struct dentry *dentry);
189+
struct dentry *dentry, int ia_valid);
190190
extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
191191
const void *xattr_value, size_t xattr_value_len);
192192
extern int ima_inode_set_acl(struct mnt_idmap *idmap,
@@ -206,7 +206,7 @@ static inline bool is_ima_appraise_enabled(void)
206206
}
207207

208208
static inline void ima_inode_post_setattr(struct mnt_idmap *idmap,
209-
struct dentry *dentry)
209+
struct dentry *dentry, int ia_valid)
210210
{
211211
return;
212212
}

security/integrity/ima/ima_appraise.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,15 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
629629
* ima_inode_post_setattr - reflect file metadata changes
630630
* @idmap: idmap of the mount the inode was found from
631631
* @dentry: pointer to the affected dentry
632+
* @ia_valid: for the UID and GID status
632633
*
633634
* Changes to a dentry's metadata might result in needing to appraise.
634635
*
635636
* This function is called from notify_change(), which expects the caller
636637
* to lock the inode's i_mutex.
637638
*/
638639
void ima_inode_post_setattr(struct mnt_idmap *idmap,
639-
struct dentry *dentry)
640+
struct dentry *dentry, int ia_valid)
640641
{
641642
struct inode *inode = d_backing_inode(dentry);
642643
struct integrity_iint_cache *iint;

0 commit comments

Comments
 (0)