Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Enrico Bravi <enrico.bravi@polito.it>,
	linux-integrity@vger.kernel.org, dmitry.kasatkin@gmail.com,
	roberto.sassu@huawei.com
Cc: eric.snowberg@oracle.com
Subject: Re: [PATCH v5 2/2] ima: measure userspace policy writes before parsing
Date: Mon, 06 Jul 2026 23:03:49 -0400	[thread overview]
Message-ID: <002330a72cdec8eaa554fddd5b8d428245ed83e4.camel@linux.ibm.com> (raw)
In-Reply-To: <20260702190403.5844-3-enrico.bravi@polito.it>

On Thu, 2026-07-02 at 21:04 +0200, Enrico Bravi wrote:

> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index a65b7e4b64d6..d6d249190705 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -591,6 +593,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule,
>  	switch (func) {
>  	case KEY_CHECK:
>  	case CRITICAL_DATA:
> +	case POLICY_CHECK:
>  		return ((rule->func == func) &&
>  			ima_match_rule_data(rule, func_data, cred));
>  	default:

Hi Enrico,

Unlike the other hooks, KEY_CHECK and CRITICAL_DATA are special cases, which
only allow a set of keyrings or labels respectively.  POLICY_CHECK rules can be
defined in terms of other file metadata (e.g. uid, gid, ...). With this change,
any options specified on the rule will be not be matched.

ima_match_rule_data() should only be called for buffer measurements, when there
is no inode. 

+               return ((rule->func == func) && !inode &&
                        ima_match_rule_data(rule, func_data, cred));

Otherwise the patch looks good.

Mimi

  reply	other threads:[~2026-07-07  3:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 19:04 [PATCH v5 0/2] ima: measure write on securityfs policy file Enrico Bravi
2026-07-02 19:04 ` [PATCH v5 1/2] ima: add critical data measurement for loaded policy Enrico Bravi
2026-07-07  3:04   ` Mimi Zohar
2026-07-07 11:25     ` Enrico  Bravi
2026-07-07 23:53     ` Mimi Zohar
2026-07-02 19:04 ` [PATCH v5 2/2] ima: measure userspace policy writes before parsing Enrico Bravi
2026-07-07  3:03   ` Mimi Zohar [this message]
2026-07-07 15:25     ` Enrico  Bravi
2026-07-07 20:06       ` 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=002330a72cdec8eaa554fddd5b8d428245ed83e4.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=enrico.bravi@polito.it \
    --cc=eric.snowberg@oracle.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.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