Re: [PATCH slab/for-next 11/14] smack: specify SLAB_MAY_ACCOUNT for smack_rule cache

From: Harry Yoo

Date: Thu Oct 22 2026 - 08:56:26 EST


On Wed, Oct 21, 2026 at 12:14:39PM -0700, Casey Schaufler wrote:
> On 10/21/2026 11:48 AM, Harry Yoo wrote:
> > On Wed, Oct 21, 2026 at 09:59:15AM -0700, Casey Schaufler wrote:
> >> On 10/21/2026 4:46 AM, Harry Yoo (Meta) wrote:
> >>> smk_copy_rules() allocates rules with the gfp passed from
> >>> security_prepare_creds(), which is GFP_KERNEL_ACCOUNT. Specify
> >>> SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
> >>> __GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
> >>>
> >>> Path: fork() -> copy_creds() -> prepare_creds()
> >>> -> security_prepare_creds(GFP_KERNEL_ACCOUNT) -> smack_cred_prepare()
> >>> -> smk_copy_rules() -> kmem_cache_zalloc(smack_rule_cache)
> >>>
> >>> Assisted-by: LLM
> >>> Cc: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>
> >>> Cc: Paul Moore <paul@xxxxxxxxxxxxxx>
> >>> Cc: James Morris <jmorris@xxxxxxxxx>
> >>> Cc: "Serge E. Hallyn" <serge@xxxxxxxxxx>
> >>> Cc: linux-security-module@xxxxxxxxxxxxxxx
> >>> Signed-off-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
> >> How was this change tested?
>
> Brilliant response. Thank you. Add my
>
> Reviewed-by: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>

No problem :)
Thank you, have a nice day!

--
Cheers,
Harry / Hyeonggon