From: Mimi Zohar <zohar@linux.ibm.com>
To: Enrico Bravi <enrico.bravi@polito.it>,
"roberto.sassu@huawei.com" <roberto.sassu@huawei.com>,
"linux-integrity@vger.kernel.org"
<linux-integrity@vger.kernel.org>,
"dmitry.kasatkin@gmail.com" <dmitry.kasatkin@gmail.com>
Cc: "eric.snowberg@oracle.com" <eric.snowberg@oracle.com>
Subject: Re: [PATCH v4 2/2] ima: measure buffer sent to securityfs policy file
Date: Mon, 29 Jun 2026 12:38:56 -0400 [thread overview]
Message-ID: <86ffed9e24d15bb726b836e92d18dc7bbb7593e4.camel@linux.ibm.com> (raw)
In-Reply-To: <28759e3a57545d6d401ed111f38bd7e8b2ecf59d.camel@polito.it>
On Mon, 2026-06-29 at 09:26 +0000, Enrico Bravi wrote:
> > > diff --git a/security/integrity/ima/ima_fs.c
> > > b/security/integrity/ima/ima_fs.c
> > > index 65e7812c702f..a277c9135944 100644
> > > --- a/security/integrity/ima/ima_fs.c
> > > +++ b/security/integrity/ima/ima_fs.c
> > > @@ -356,6 +356,7 @@ static ssize_t ima_write_policy(struct file *file, const
> > > char __user *buf,
> > > 1, 0);
> > > result = -EACCES;
> > > } else {
> > > + ima_measure_policy_buf(data, datalen);
> >
> > Should failure to measure the input policy rules be audited?
>
> process_buffer_measurement() is already auditing in case of failure before
> returning. Do you think it is necessary to audit also at this point?
No, you're correct.
>
> > > result = ima_parse_add_rule(data);
> > > }
> > > mutex_unlock(&ima_write_mutex);
> > > diff --git a/security/integrity/ima/ima_main.c
> > > b/security/integrity/ima/ima_main.c
> > > index 5cea53fc36df..599495304712 100644
> > > --- a/security/integrity/ima/ima_main.c
> > > +++ b/security/integrity/ima/ima_main.c
> > > @@ -1221,6 +1221,25 @@ int ima_measure_critical_data(const char
> > > *event_label,
> > > }
> > > EXPORT_SYMBOL_GPL(ima_measure_critical_data);
> > >
> > > +/**
> > > + * ima_measure_policy_buf - Measure the policy write buffer
> >
> > Consider renaming this function to ima_measure_policy_input(), which parallels
> > the function ima_measure_loaded_policy() in the first patch.
>
> My intention with the previous ima_measure_policy_write() name was to highlight
> the fact it is not measuring every data sent to the policy file. For example,
> writing the path of the file from which reading the new policy does not trigger
> this measurement. Eventually, what do you think of ima_measure_raw_policy() or
> ima_measure_unparsed_policy()?
The policy could have comment lines, which are being measured. Naming the
function ima_measure_raw_policy() is perfect.
>
thanks,
Mimi
prev parent reply other threads:[~2026-06-29 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 15:58 [PATCH v4 0/2] ima: measure write on securityfs policy file Enrico Bravi
2026-06-17 15:58 ` [PATCH v4 1/2] ima: measure loaded policy after " Enrico Bravi
2026-06-24 20:35 ` Mimi Zohar
2026-06-25 14:17 ` Mimi Zohar
2026-06-26 9:36 ` Enrico Bravi
2026-06-26 9:32 ` Enrico Bravi
2026-06-26 13:37 ` Mimi Zohar
2026-06-17 15:58 ` [PATCH v4 2/2] ima: measure buffer sent to " Enrico Bravi
2026-06-25 1:05 ` Mimi Zohar
2026-06-29 9:26 ` Enrico Bravi
2026-06-29 16:38 ` Mimi Zohar [this message]
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=86ffed9e24d15bb726b836e92d18dc7bbb7593e4.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