Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: Chris Down <chris@chrisdown.name>
Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	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: Fri, 4 Dec 2026 12:12:01 +0000	[thread overview]
Message-ID: <axHy2fPB63lBBoGY@thinkstation> (raw)
In-Reply-To: <awu2R73hy6gULDkz@chrisdown.name>

On Sat, Nov 28, 2026 at 09:21:11PM -0800, Chris Down wrote:
> Hi Vlastimil,
> 
> Vlastimil Babka (SUSE) writes:
> >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.
> 
> Yes, it is ugly. Given that Harry asked for one of those [1], how about
> a single SLAB_HARDENING_DEFAULT_ON for both features in v4?

Revisiting my own proposal, the main reason why I suggested
*_DEFAULT_ON flags is because unconditionally compiling hardening
features could have measurable overhead e.g.) partitioned kmalloc
caches.

For SLAB_FREELIST_RANDOM and SLAB_FREELIST_HARDENED, unconditionally
compiling in the feature has negligible overhead so we could instead
let them determine default behaviour instead of introducing _DEFAULT_ON
configs.

For SLAB_BUCKETS, Vlastimil is working on making it less expensive to
enable at runtime (which is inspired by your series)
https://lore.kernel.org/linux-mm/20261203-kmalloc-entry-rework-v2-0-d718dc4fd906@kernel.org

  "If this is accepted, [1] should be rebased on it as it makes the
  slab_buckets boot-time handling really straightforward. In fact
  CONFIG_SLAB_BUCKETS could be repurposed to only control the default
  behavior, while the code is always compiled in."

With that, SLAB_FREELIST_RANDOM, SLAB_FREELIST_HARDENED, SLAB_BUCKETS
could always be in compiled and repurposed to determine the default
behavior instead of *_DEFAULT_ON.

For KMALLOC_PARTITION_CACHES I don't have strong opinion on having
_DEFAULT_ON flag for this, but I'd argue it's fairly reasonable to
assume it's on by default when it's compiled in, as compiling in the
feature has _some_ overhead already.

With that and slab_hardening= boot parameter I don't have any further
concern to raise at the moment.

Does that sound good to you, Chris?

> The downside is that SLAB_BUCKETS defaults to
> SLAB_FREELIST_HARDENED, which this series makes default y, so a defconfig
> kernel would get the buckets built in and on at boot.

...with above we don't need to worry about this!

-- 
Cheers,
Harry / Hyeonggon


      reply	other threads:[~2026-12-04 12:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  8:51 [PATCH v3 0/6] mm/slab: Support selecting slab hardening features at boot 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-14  8:52   ` sashiko-bot
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-29  5:21       ` Chris Down
2026-11-29  5:21   ` Chris Down
2026-11-16 16:55 ` Vlastimil Babka (SUSE)
2026-11-29  5:21   ` Chris Down
2026-12-04 12:12     ` Harry Yoo [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=axHy2fPB63lBBoGY@thinkstation \
    --to=harry@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=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 \
    --cc=vbabka@kernel.org \
    /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