From: Mimi Zohar <zohar@linux.ibm.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>,
James Morris <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
linux-integrity@vger.kernel.org,
linux-security-module <linux-security-module@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Eric Biggers <ebiggers@kernel.org>,
Kees Cook <keescook@chromium.org>
Subject: [PATCH 1/2] ima: don't access a file's integrity status before an IMA policy is loaded
Date: Mon, 22 Mar 2021 11:42:06 -0400 [thread overview]
Message-ID: <20210322154207.6802-1-zohar@linux.ibm.com> (raw)
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
next reply other threads:[~2021-03-22 15:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 15:42 Mimi Zohar [this message]
2021-03-22 15:42 ` [PATCH 2/2] integrity: double check iint_cache was initialized Mimi Zohar
2021-03-22 16:52 ` Eric Biggers
2021-03-22 18:02 ` Mimi Zohar
2022-02-24 14:20 ` Petr Vorel
2022-02-24 17:32 ` Casey Schaufler
2022-02-24 17:42 ` Petr Vorel
2022-02-24 18:51 ` Casey Schaufler
2022-02-25 19:58 ` Mimi Zohar
2022-02-28 13:44 ` Petr Vorel
2022-02-28 16:48 ` Mimi Zohar
2021-03-22 16:51 ` [PATCH 1/2] ima: don't access a file's integrity status before an IMA policy is loaded Eric Biggers
2021-03-22 18:02 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210322154207.6802-1-zohar@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=dvyukov@google.com \
--cc=ebiggers@kernel.org \
--cc=jmorris@namei.org \
--cc=keescook@chromium.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).