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

From: Hao Li

Date: Thu Dec 03 2026 - 10:06:03 EST


On Wed, Nov 25, 2026 at 09:37:12PM +0000, 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)
>
> 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
> Reviewed-by: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>
> Signed-off-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
> ---
> security/smack/smack_lsm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Looks good to me.
Reviewed-by: Hao Li <hao.li@xxxxxxxxx>

--
Thanks,
Hao