Linux-Integrity Archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: GUO Zihua <guozihua@huawei.com>,
	roberto.sassu@huawei.com, dmitry.kasatkin@gmail.com,
	paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com,
	stephen.smalley.work@gmail.com
Cc: eric.snowberg@oracle.com, omosnace@redhat.com,
	linux-integrity@vger.kernel.org, selinux@vger.kernel.org
Subject: Re: [PATCH v2] ima: Avoid blocking in RCU read-side critical section
Date: Wed, 01 May 2024 16:48:32 -0400	[thread overview]
Message-ID: <870ebd4d7a8789bfe55056635dcf9a308d5b0e40.camel@linux.ibm.com> (raw)
In-Reply-To: <20240428091045.85513-1-guozihua@huawei.com>

Hi Scott,

On Sun, 2024-04-28 at 09:10 +0000, GUO Zihua wrote:
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index c0556907c2e6..216ffe388ce5 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -410,7 +410,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
>          * Immutable elements are copied over as pointers and data; only
>          * lsm rules can change
>          */
> -       nentry = kmemdup(entry, sizeof(*nentry), GFP_KERNEL);
> +       nentry = kmemdup(entry, sizeof(*nentry), GFP_ATOMIC);
>         if (!nentry)
>                 return NULL;
>  
> @@ -425,7 +425,8 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
>  
>                 ima_filter_rule_init(nentry->lsm[i].type, Audit_equal,
>                                      nentry->lsm[i].args_p,
> -                                    &nentry->lsm[i].rule);
> +                                    &nentry->lsm[i].rule,
> +                                    GFP_ATOMIC);
>                 if (!nentry->lsm[i].rule)
>                         pr_warn("rule for LSM \'%s\' is undefined\n",
>                                 nentry->lsm[i].args_p);

If only the call to ima_lsm_copy_rule() in ima_match_rules() needs to be
GFP_ATOMIC, then pass the gfp type.

thanks,

Mimi


> @@ -1140,7 +1141,8 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry,
>         entry->lsm[lsm_rule].type = audit_type;
>         result = ima_filter_rule_init(entry->lsm[lsm_rule].type, Audit_equal,
>                                       entry->lsm[lsm_rule].args_p,
> -                                     &entry->lsm[lsm_rule].rule);
> +                                     &entry->lsm[lsm_rule].rule,
> +                                     GFP_KERNEL);
>         if (!entry->lsm[lsm_rule].rule) {
>                 pr_warn("rule for LSM \'%s\' is undefined\n",
>                         entry->lsm[lsm_rule].args_p);


      parent reply	other threads:[~2024-05-01 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  9:10 [PATCH v2] ima: Avoid blocking in RCU read-side critical section GUO Zihua
2024-04-28 16:39 ` Casey Schaufler
2024-05-01 20:48 ` 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=870ebd4d7a8789bfe55056635dcf9a308d5b0e40.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=guozihua@huawei.com \
    --cc=jmorris@namei.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=selinux@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=stephen.smalley.work@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).