Re: [PATCH 0/8] mm/slab: Support selecting slab hardening features at boot
From: Vlastimil Babka (SUSE)
Date: Tue Oct 27 2026 - 04:11:05 EST
On 10/27/26 08:35, Chris Down wrote:
> Slab hardening settings are currently all build time choices. This means
> that, unfortunately, hosts with different requirements end up needing
> separate kernel images. Let's allow those hosts to use one image and
> select each policy at boot instead.
>
> This series adds four new boot parameters that default to their values
> from CONFIG_*:
>
> slab_freelist_hardened=
> slab_freelist_random=
These two should be only a small cpu overhead, which is why distros
generally enable them [1]. Also the code basically only runs in slowpaths
because percpu caching doesn't use freelists. It's possible the static key
conversion doesn't help anything. You could try to measure the impact, I'd
be surprised perhaps :)
Maybe we should just make them default=y.
> slab_buckets=
> kmalloc_partition=
These are more valid as there's a memory overhead tradeoff.
[1]
https://oracle.github.io/kconfigs/?config=UTS_RELEASE&config=SLAB_FREELIST_RANDOM&config=SLAB_FREELIST_HARDENED
> These mostly act at cache initialisation time. For free list hardening we
> use a static key settled before the first free pointer is written.
>
> Chris Down (8):
> mm/slub: Support disabling freelist hardening at boot
> slub_kunit: Add a test for slab_freelist_hardened=
> mm/slub: Support disabling freelist randomisation at boot
> slub_kunit: Add a test for slab_freelist_random=
> mm/slab: Support disabling SLAB_BUCKETS at boot
> slub_kunit: Add a test for the slab_buckets boot parameter
> mm/slab: Support disabling KMALLOC_PARTITION_CACHES at boot
> slub_kunit: Add a test for the kmalloc_partition boot parameter
>
> .../admin-guide/kernel-parameters.txt | 29 +++
> lib/tests/slub_kunit.c | 186 ++++++++++++++++++
> mm/Kconfig | 15 ++
> mm/slab.h | 24 +++
> mm/slab_common.c | 48 ++++-
> mm/slub.c | 68 ++++++-
> scripts/gdb/linux/slab.py | 8 +-
> 7 files changed, 361 insertions(+), 17 deletions(-)
>
>
> base-commit: d15d7703166daf7bd62c844a3cb1b3a6279adb4c