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

From: Stefan Berger
Date: Thu Jul 07 2022 - 10:12:43 EST




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@xxxxxxxxxx>


}
ima_update_policy_flags(ns);
--
2.34.1