From: Roberto Sassu Date: Fri, 14 May 2021 15:27:53 +0000 (+0200) Subject: ima: Don't remove security.ima if file must not be appraised X-Git-Tag: accepted/tizen/unified/20230118.172025~6985^2~12^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed1b472fc15aeaa20ddeeb93fd25190014e50d17;p=platform%2Fkernel%2Flinux-rpi.git ima: Don't remove security.ima if file must not be appraised Files might come from a remote source and might have xattrs, including security.ima. It should not be IMA task to decide whether security.ima should be kept or not. This patch removes the removexattr() system call in ima_inode_post_setattr(). Signed-off-by: Roberto Sassu Signed-off-by: Mimi Zohar --- diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index d9a627d..940695e 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -532,8 +532,6 @@ void ima_inode_post_setattr(struct user_namespace *mnt_userns, return; action = ima_must_appraise(mnt_userns, inode, MAY_ACCESS, POST_SETATTR); - if (!action) - __vfs_removexattr(&init_user_ns, dentry, XATTR_NAME_IMA); iint = integrity_iint_find(inode); if (iint) { set_bit(IMA_CHANGE_ATTR, &iint->atomic_flags);