linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] ima: don't access a file's integrity status before an IMA policy is loaded
@ 2021-03-19 20:03 Mimi Zohar
  2021-03-19 20:03 ` [RFC PATCH 2/2] integrity: double check iint_cache was initialized Mimi Zohar
  0 siblings, 1 reply; 19+ messages in thread
From: Mimi Zohar @ 2021-03-19 20:03 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: linux-integrity, Test, James Morris, Serge E . Hallyn,
	linux-security-module, LKML, Eric Biggers, Mimi Zohar

From: Test <test@localhost.localdomain>

Only after an IMA policy is loaded, check, save, or update the cached
file's integrity status.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
 security/integrity/ima/ima_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 9ef748ea829f..9d1196f712e1 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -606,6 +606,9 @@ void ima_post_create_tmpfile(struct user_namespace *mnt_userns,
 	struct integrity_iint_cache *iint;
 	int must_appraise;
 
+	if (!ima_policy_flag || !S_ISREG(inode->i_mode))
+		return;
+
 	must_appraise = ima_must_appraise(mnt_userns, inode, MAY_ACCESS,
 					  FILE_CHECK);
 	if (!must_appraise)
@@ -636,6 +639,9 @@ void ima_post_path_mknod(struct user_namespace *mnt_userns,
 	struct inode *inode = dentry->d_inode;
 	int must_appraise;
 
+	if (!ima_policy_flag || !S_ISREG(inode->i_mode))
+		return;
+
 	must_appraise = ima_must_appraise(mnt_userns, inode, MAY_ACCESS,
 					  FILE_CHECK);
 	if (!must_appraise)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-03-24 15:57 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 20:03 [RFC PATCH 1/2] ima: don't access a file's integrity status before an IMA policy is loaded Mimi Zohar
2021-03-19 20:03 ` [RFC PATCH 2/2] integrity: double check iint_cache was initialized Mimi Zohar
2021-03-22  7:10   ` Tetsuo Handa
2021-03-22  7:53     ` Dmitry Vyukov
2021-03-23  1:46       ` Tetsuo Handa
2021-03-23 12:09         ` Mimi Zohar
2021-03-23 13:37           ` Tetsuo Handa
2021-03-23 14:01             ` Tetsuo Handa
2021-03-23 14:47               ` Mimi Zohar
2021-03-23 15:14                 ` Tetsuo Handa
2021-03-23 16:13                   ` Mimi Zohar
2021-03-24 10:10                     ` Tetsuo Handa
2021-03-24 11:10                       ` Mimi Zohar
2021-03-24 11:20                         ` Tetsuo Handa
2021-03-24 11:37                           ` Dmitry Vyukov
2021-03-24 11:49                             ` Mimi Zohar
2021-03-24 11:58                               ` Dmitry Vyukov
2021-03-24 12:17                                 ` Mimi Zohar
2021-03-24 15:56                                 ` Casey Schaufler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).