From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386323; b=WFAj+5ymFI/+dgHZRzdUgenhzK7pDlmj4oEz+FbtXrWBhm/Dxoy3uzMlYYFWX089sTD7 gaOxBgp+Mko7KvcV9OjRk2uhDs8eUEXX97arBFXQxSHwAgX5yh31hc/YqqG/6X3M8Ajjz KgqrXkz1RsucS7iOsc86EzLJ9ToT4W5jYNCgITSu86iLlLFcYwxw/GiUuRKcvCQGIjugB 7G3zmqizNMOEkE6AeYohkYGZsFr8vSpSMKyvrwuhqg3wBfJX5jyIg6q/Trn8cMYy1+Mwq Kuo0gWyiQ8qRKamfRqR6/DZ7OZr4wSEEgu+QXg/5mGK1yCu9sRdMcLNKw01N+qf8BWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386323; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=qO4RlI4tV4TloYvBuhoXC1h1GAN/szc+tf+/yetOzFE=; b=26VLGKK68m0/zmEwy2Lot/33W07oKDX9ugOn2fYz6htfirM5YIFTF00qaNWaqPnYEW59 GbvW8PkeZg8WWRUIZsvHJ8VaC7GhFP/B58D+/j1tBVAhG11NK2bYXP60Db6Wn6gKNmm+H 3oGef1JfnBU4/4WBNXGngVvBNbYTau4lUvvabPqjatr6Tx06Cx4VXqoXvFmBn+d8L2SUH VSaT9cdvV4cemrvVriWQwvHXWvRksQ7Io4+qFncU4+TwkZcPDZ1vLeePzCt9MsGtqdlBN x5+KYND2clPe1zrJO6WbYwa1ycdG4ocslzTFpBUym+53tRViRcMxy9dAcXorS50USFQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bzjqiu55; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72754606A335; Fri, 4 Dec 2026 12:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bzjqiu55 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C58001F000CE; Fri, 4 Dec 2026 12:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796386323; bh=qO4RlI4tV4TloYvBuhoXC1h1GAN/szc+tf+/yetOzFE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bzjqiu55nvD174UVIrqUBnADdokT4TNjFRU0M6d6fYh2vA+tHq6CZK3r5cDxVVo42 dyoYr1H1x1qg9tdwtJ1syMm0gvvFHCiZ0mKTq1tj8d7F6GCrb/En1tRIlNJKiePjTG QRJmhY6SAe+KTkqv0YKcGHS25VURv8wTQ+M1/+VRyYN1w6OYpj7mDa1Kr3UsiCMPGc mZrWK65kx9axv2/OJLMsaKZpwEBkUHu1QiWV6DKeWsQueL9R2Ge12tDFciGvVLE1ce mWRNVQ8DLzw7INdd8hH7Rd5hdbOaLKPJmAe5GH2fRWi6yhqJFt08rD6i3LWDvz1Oxa aKkB7I33HlxPg== Date: Fri, 4 Dec 2026 12:12:01 +0000 From: Harry Yoo To: Chris Down Cc: "Vlastimil Babka (SUSE)" , Andrew Morton , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Kees Cook , Marco Elver , GONG Ruiqi , Jonathan Corbet , 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 Message-ID: References: <8b6e489a-eb73-4b2a-ac65-dfadc8c73bfc@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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