Skip to content

Commit 42a4c60

Browse files
author
Mimi Zohar
committed
ima: fix ima_inode_post_setattr
Changing file metadata (eg. uid, guid) could result in having to re-appraise a file's integrity, but does not change the "new file" status nor the security.ima xattr. The IMA_PERMIT_DIRECTIO and IMA_DIGSIG_REQUIRED flags are policy rule specific. This patch only resets these flags, not the IMA_NEW_FILE or IMA_DIGSIG flags. With this patch, changing the file timestamp will not remove the file signature on new files. Reported-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Tested-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
1 parent 39d637a commit 42a4c60

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

security/integrity/ima/ima_appraise.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void ima_inode_post_setattr(struct dentry *dentry)
328328
if (iint) {
329329
iint->flags &= ~(IMA_APPRAISE | IMA_APPRAISED |
330330
IMA_APPRAISE_SUBMASK | IMA_APPRAISED_SUBMASK |
331-
IMA_ACTION_FLAGS);
331+
IMA_ACTION_RULE_FLAGS);
332332
if (must_appraise)
333333
iint->flags |= IMA_APPRAISE;
334334
}

security/integrity/integrity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
/* iint cache flags */
3030
#define IMA_ACTION_FLAGS 0xff000000
31+
#define IMA_ACTION_RULE_FLAGS 0x06000000
3132
#define IMA_DIGSIG 0x01000000
3233
#define IMA_DIGSIG_REQUIRED 0x02000000
3334
#define IMA_PERMIT_DIRECTIO 0x04000000

0 commit comments

Comments
 (0)