From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Roberto Sassu <roberto.sassu@huawei.com>, zohar@linux.ibm.com
Cc: tusharsu@linux.microsoft.com, linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ima: Support euid keyword for buffer measurement
Date: Tue, 6 Jul 2021 12:29:47 -0700 [thread overview]
Message-ID: <2996f5ae-d76f-5fc9-bf90-857d4fc6644a@linux.microsoft.com> (raw)
In-Reply-To: <20210705115650.3373599-1-roberto.sassu@huawei.com>
On 7/5/2021 4:56 AM, Roberto Sassu wrote:
Hi Roberto,
> This patch makes the 'euid' keyword available for buffer measurement rules,
> in the same way as for other rules. Currently, there is only support for
> the 'uid' keyword.
>
> With this change, buffer measurement (or non-measurement) can depend also
> on the process effective UID.
Who (kernel component) will be using this?
Maybe you could make this change as part of the patch set in which the
above "euid" support will be used.
thanks,
-lakshmi
>
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> ---
> security/integrity/ima/ima_policy.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index fd5d46e511f1..fdaa030fb04b 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -480,6 +480,16 @@ static bool ima_match_rule_data(struct ima_rule_entry *rule,
> if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
> return false;
>
> + if (rule->flags & IMA_EUID) {
> + if (has_capability_noaudit(current, CAP_SETUID)) {
> + if (!rule->uid_op(cred->euid, rule->uid)
> + && !rule->uid_op(cred->suid, rule->uid)
> + && !rule->uid_op(cred->uid, rule->uid))
> + return false;
> + } else if (!rule->uid_op(cred->euid, rule->uid))
> + return false;
> + }
> +
> switch (rule->func) {
> case KEY_CHECK:
> if (!rule->keyrings)
> @@ -1153,7 +1163,7 @@ static bool ima_validate_rule(struct ima_rule_entry *entry)
> if (entry->action & ~(MEASURE | DONT_MEASURE))
> return false;
>
> - if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR |
> + if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_EUID | IMA_PCR |
> IMA_LABEL))
> return false;
>
>
next prev parent reply other threads:[~2021-07-06 19:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 11:56 [PATCH] ima: Support euid keyword for buffer measurement Roberto Sassu
2021-07-06 19:29 ` Lakshmi Ramasubramanian [this message]
2021-07-07 7:15 ` Roberto Sassu
2021-07-19 21:30 ` 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=2996f5ae-d76f-5fc9-bf90-857d4fc6644a@linux.microsoft.com \
--to=nramas@linux.microsoft.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=roberto.sassu@huawei.com \
--cc=tusharsu@linux.microsoft.com \
--cc=zohar@linux.ibm.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).