Files
linux/ipc
Kees Cook c57fbbe42e ipc, msg: Account msg_msg allocations with GFP_KERNEL_ACCOUNT again
Since commit 734bbc1c97 ("ipc, msg: Use dedicated slab buckets for
alloc_msg()"), alloc_msg() allocates with GFP_KERNEL, and a msg_msg is
accounted only through SLAB_ACCOUNT on its bucket caches. With
CONFIG_SLAB_BUCKETS=n, kmem_buckets_create() creates no caches and
kmem_buckets_alloc() is a GFP_KERNEL kmalloc() from the general caches,
which do not account it; the same happens when kmem_buckets_create()
fails. Either way, the allocation is not charged to the sender's memory
cgroup.

Allocate with GFP_KERNEL_ACCOUNT again, as before that commit, so the
allocation is charged whichever cache serves it.

Build tested ARCH=x86_64 defconfig with GCC 16.2.0, with
CONFIG_SLAB_BUCKETS as y and n.

Fixes: 734bbc1c97 ("ipc, msg: Use dedicated slab buckets for alloc_msg()")
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Vlastimil Babka (SUSE) <[email protected]>
Reviewed-by: Harry Yoo (Meta) <[email protected]>
Reviewed-by: Pedro Falcato <[email protected]>
Signed-off-by: Harry Yoo (Meta) <[email protected]>
2026-10-16 15:52:26 +01:00
..
2026-05-27 14:10:25 +02:00
2019-11-15 14:38:27 +01:00
2023-12-20 19:26:31 -05:00