linux/kernel/configs
Kees Cook 67f2df3b82 mm/slab: Plumb kmem_buckets into __do_kmalloc_node()
Introduce CONFIG_SLAB_BUCKETS which provides the infrastructure to
support separated kmalloc buckets (in the following kmem_buckets_create()
patches and future codetag-based separation). Since this will provide
a mitigation for a very common case of exploits, it is recommended to
enable this feature for general purpose distros. By default, the new
Kconfig will be enabled if CONFIG_SLAB_FREELIST_HARDENED is enabled (and
it is added to the hardening.config Kconfig fragment).

To be able to choose which buckets to allocate from, make the buckets
available to the internal kmalloc interfaces by adding them as the
second argument, rather than depending on the buckets being chosen from
the fixed set of global buckets. Where the bucket is not available,
pass NULL, which means "use the default system kmalloc bucket set"
(the prior existing behavior), as implemented in kmalloc_slab().

To avoid adding the extra argument when !CONFIG_SLAB_BUCKETS, only the
top-level macros and static inlines use the buckets argument (where
they are stripped out and compiled out respectively). The actual extern
functions can then be built without the argument, and the internals
fall back to the global kmalloc buckets unconditionally.

Co-developed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
2024-07-03 12:24:19 +02:00
..
debug.config configs/debug: add NET debug config 2024-02-15 17:46:53 -08:00
hardening.config mm/slab: Plumb kmem_buckets into __do_kmalloc_node() 2024-07-03 12:24:19 +02:00
kvm_guest.config kbuild: Show marked Kconfig fragments in "help" 2023-09-04 02:04:20 +09:00
nopm.config kbuild: Show marked Kconfig fragments in "help" 2023-09-04 02:04:20 +09:00
rust.config kbuild: Show marked Kconfig fragments in "help" 2023-09-04 02:04:20 +09:00
tiny-base.config treewide: drop CONFIG_EMBEDDED 2023-08-21 13:46:25 -07:00
tiny.config mm/slab: rename CONFIG_SLAB to CONFIG_SLAB_DEPRECATED 2023-05-26 19:01:47 +02:00
x86_debug.config kbuild: Show marked Kconfig fragments in "help" 2023-09-04 02:04:20 +09:00
xen.config kbuild: Show marked Kconfig fragments in "help" 2023-09-04 02:04:20 +09:00