Re: [PATCH v2] ima: Avoid blocking in RCU read-side critical section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux