forked from clearlinux-pkgs/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-ima-Use-i_version-only-when-filesystem-supports-it.patch
39 lines (33 loc) · 1.51 KB
/
0001-ima-Use-i_version-only-when-filesystem-supports-it.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From ac0bf025d2c0e88097f0ab247e7460053fef7e9d Mon Sep 17 00:00:00 2001
From: Sascha Hauer <[email protected]>
Date: Mon, 11 Dec 2017 06:35:20 -0500
Subject: [PATCH 01/22] ima: Use i_version only when filesystem supports it
i_version is only supported by a filesystem when the SB_I_VERSION
flag is set. This patch tests for the SB_I_VERSION flag before using
i_version. If we can't use i_version to detect a file change then we
must assume the file has changed in the last_writer path and remeasure
it.
On filesystems without i_version support IMA used to measure a file
only once and didn't detect any changes to a file. With this patch
IMA now works properly on these filesystems.
Signed-off-by: Sascha Hauer <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
---
security/integrity/ima/ima_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 770654694efc..50b82599994d 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -127,7 +127,8 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint,
inode_lock(inode);
if (atomic_read(&inode->i_writecount) == 1) {
- if ((iint->version != inode->i_version) ||
+ if (!IS_I_VERSION(inode) ||
+ (iint->version != inode->i_version) ||
(iint->flags & IMA_NEW_FILE)) {
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
iint->measured_pcrs = 0;
--
2.16.1