Re: [PATCH v12 04/26] ima: Move arch_policy_entry into ima_namespace

Stefan Berger
2022-07-07T14:12:32Z

On 5/20/22 22:46, Serge E. Hallyn wrote:
> On Wed, Apr 20, 2022 at 10:06:11AM -0400, Stefan Berger wrote:

>> @@ -1005,7 +1003,8 @@ void ima_update_policy(struct ima_namespace *ns)
>> * on boot. After loading a custom policy, free the
>> * architecture specific rules stored as an array.
>> */
>> - kfree(arch_policy_entry);
>> + kfree(ns->arch_policy_entry);
>> + ns->arch_policy_entry = NULL;
>
> So the thing that prevents multiple racing occurances of the above two lines is
> that ima_open_policy() sets IMA_FS_BUSY (or returns EBUSY) and then removes
> this file before clearing the flag, right?

Correct.

>
> Seems good.
>
> Reviewed-by: Serge Hallyn <serge@hallyn.com>
>
>
>> }
>> ima_update_policy_flags(ns);
>>
>> --
>> 2.34.1