From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Chris Down <chris@chrisdown.name>, Harry Yoo <harry@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Kees Cook <kees@kernel.org>, Marco Elver <elver@google.com>,
GONG Ruiqi <gongruiqi@huaweicloud.com>,
Jonathan Corbet <corbet@lwn.net>,
linux-mm@kvack.org, linux-hardening@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH v3 0/6] mm/slab: Support selecting slab hardening features at boot
Date: Mon, 16 Nov 2026 17:55:16 +0100 [thread overview]
Message-ID: <8b6e489a-eb73-4b2a-ac65-dfadc8c73bfc@kernel.org> (raw)
In-Reply-To: <cover.1794506262.git.chris@chrisdown.name>
On 11/13/26 09:51, 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. At Meta, for example, some hosts are built with
> these options and the rest of the fleet isn't, and that's one of the
> things that keeps those kernels apart.
>
> This series does two things:
>
> - SLAB_FREELIST_HARDENED and SLAB_FREELIST_RANDOM are cheap enough with
> sheaves that it makes more sense to just enable them by default than
> to make them switchable. With both on, system level benchmarks didn't
> change measurably, only slowpath heavy microbenchmarks did [1].
>
> - SLAB_BUCKETS and KMALLOC_PARTITION_CACHES cost memory (Harry measured
> about 1 MiB and 18 MiB respectively after boot on a 64 CPU VM [2]), so
> they get slab_buckets= and kmalloc_partition= boot parameters, which
> default to on when the option is built in.
I'm not thrilled about the "default to on". We usually do these features
opt-in. Now our distro kernel would likely need to have these "disable this"
options in the default command line, with documentation to remove it for a
hardened setup.
But yeah doing it opt-in, the hardened setups would now have to start
passing the extra params to enable this, even if until now enabling the
config option was enough. Also not great, but we can argue they are still
the minority?
Of course there's always the possibility of adding another _DEFAUT_ON
configs. Not great either. Sigh.
> Whether those two should be folded into a single slab_hardening= is
> still open [3].
>
> v3:
>
> - Rebase onto slab/for-next.
> - Always build the slab_buckets and kmalloc_partition tests and skip them
> at runtime when the option isn't built in, instead of leaving them out
> with #ifdef (Kees).
> - Declare slab_buckets_enabled and kmalloc_partition_enabled in
> mm/slab.h without any #if (Kees).
> - Drop the remaining #ifdefs around slab_buckets= and
> kmalloc_partition=. Both are now always registered and ignored when
> the option isn't built in (Kees).
> - Keep both flags as plain __ro_after_init bools rather than static
> keys, since they're only read when caches are created and not on the
> allocation path.
>
> v2:
>
> - Make SLAB_FREELIST_HARDENED and SLAB_FREELIST_RANDOM default y instead
> of adding boot parameters for them (Vlastimil).
> - Skip the memdup_user() part of the slab_buckets test on !MMU
> (Sashiko).
> - Keep slab_buckets= and kmalloc_partition= separate for now. We can
> discuss whether to merge them into slab_hardening= or similar, as
> Harry suggested.
>
> v2: https://lore.kernel.org/r/cover.1793253633.git.chris@chrisdown.name
> v1: https://lore.kernel.org/r/cover.1793086056.git.chris@chrisdown.name
>
> [1] https://lore.kernel.org/r/auITixAJMfLtfa7i@chrisdown.name
> [2] https://lore.kernel.org/r/179312451613.474906.1475329637924619088@kernel.org
> [3] https://lore.kernel.org/r/aud4gPOUzvHtLYnJ@thinkstation
>
> Chris Down (6):
> mm/slab: Enable SLAB_FREELIST_HARDENED by default
> mm/slab: Enable SLAB_FREELIST_RANDOM by default
> 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 | 15 ++++
> lib/tests/slub_kunit.c | 85 +++++++++++++++++++
> mm/Kconfig | 11 +++
> mm/slab.h | 3 +
> mm/slab_common.c | 52 ++++++++++--
> 5 files changed, 157 insertions(+), 9 deletions(-)
>
>
> base-commit: ce6518e61e3b4bf4f97f7ac6204049b9eba7eb75
prev parent reply other threads:[~2026-11-16 16:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 8:51 Chris Down
2026-11-13 8:51 ` [PATCH v3 1/6] mm/slab: Enable SLAB_FREELIST_HARDENED by default Chris Down
2026-11-13 8:51 ` [PATCH v3 2/6] mm/slab: Enable SLAB_FREELIST_RANDOM " Chris Down
2026-11-13 8:51 ` [PATCH v3 3/6] mm/slab: Support disabling SLAB_BUCKETS at boot Chris Down
2026-11-13 8:51 ` [PATCH v3 4/6] slub_kunit: Add a test for the slab_buckets boot parameter Chris Down
2026-11-13 8:51 ` [PATCH v3 5/6] mm/slab: Support disabling KMALLOC_PARTITION_CACHES at boot Chris Down
2026-11-13 19:42 ` kernel test robot
2026-11-13 21:38 ` kernel test robot
2026-11-13 8:51 ` [PATCH v3 6/6] slub_kunit: Add a test for the kmalloc_partition boot parameter Chris Down
2026-11-13 10:56 ` [PATCH v3 0/6] mm/slab: Support selecting slab hardening features at boot Marco Elver
2026-11-13 18:36 ` Harry Yoo
2026-11-13 18:48 ` Harry Yoo
2026-11-16 16:55 ` Vlastimil Babka (SUSE) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b6e489a-eb73-4b2a-ac65-dfadc8c73bfc@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chris@chrisdown.name \
--cc=cl@gentwo.org \
--cc=corbet@lwn.net \
--cc=elver@google.com \
--cc=gongruiqi@huaweicloud.com \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=kees@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®