From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAC04606A32C for ; Fri, 4 Dec 2026 12:12:12 +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 kanga.kvack.org (Postfix) id 1CB646B05B4; Fri, 4 Dec 2026 07:12:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2ED6B05B5; Fri, 4 Dec 2026 07:12:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DF636B05B8; Fri, 4 Dec 2026 07:12:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E17CE6B05B4 for ; Fri, 4 Dec 2026 07:12:06 -0500 (EST) Received: from smtpin27.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DB0BA1C3A70 for ; Fri, 4 Dec 2026 12:12:05 +0000 (UTC) X-FDA: 85506187410.27.FF6F535 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf04.hostedemail.com (Postfix) with ESMTP id 3944240004 for ; Fri, 4 Dec 2026 12:12:04 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=bzjqiu55; spf=pass (imf04.hostedemail.com: domain of harry@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=harry@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796386324; b=pBaFxz6UYzJ3ucjETj/tFhLgU4vOZxn/nSEtLrljZw/l3F/Ztx61G1DUG3AJICRbr8+ivV yOE19MZ+aEsOhjCOouUf50lWbZT9U4beBELHmKk5jmStIWQMFmNpF/KH9i7Ir6tjICsipC jXHqjSuzIhvePPIV2xqTYOVZx00pX+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796386324; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qO4RlI4tV4TloYvBuhoXC1h1GAN/szc+tf+/yetOzFE=; b=dzNAdpXnYebV7Wp//hWES6L1hHMyFyXltiggqI1q6Tm/or7MfV+Y9e19VUNgaiJsLKieLP +xf9RmIVPoKhNROFDUxbuk93HZhkBH8lUfk12V/GhbcvNjMbgOgNTKXwlaY70k8csa3hZT w6SYA7ADjHuIhV1UijBkm92buIi5rsk= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=bzjqiu55; spf=pass (imf04.hostedemail.com: domain of harry@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=harry@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5D82E44445; Fri, 4 Dec 2026 12:12:03 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: 851ikdnfi4rwm6bqgkn46hiznkge3jc4 X-Rspam-User: X-Rspamd-Queue-Id: 3944240004 X-Rspamd-Server: rspam09 X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-HE-Tag: 1796386324-506745 X-HE-Meta: U2FsdGVkX19O0EYy0bQ6BL79N4GUdqTHxpWcRGy0IDWoxpBr0c1nptJKes6OSFXsTbQZwoTZZZyd/r1IJdKUG0wklCm1WzuNQcq8QcgQOIblAPgFa6OOM9Nhnko11OArzzLPtODi3U1WwcTEjtyKVgB5906hNZtLLmpoZ0OXNUgPjasREDL1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gyNgmyqADCh1feNnRR8CJIQ+swGu5vCxk9A4WYiWpKT8gHtqkkBMyVpPPYxMJyrTUPz8jzhIu6nSTLcYHpVoFB6AHVCNkCZ5UUd8MQ9AvmZXFFhctce2A9srqDG3mM7JjZRPEMZ2Oi6u7r9wxlHWtH1oz1xp3jg7PK87Z8tGgvUofkFIZ66XlsnVfU1ZrVo1FLztZCAdP7K5+ZrPmCaqiBQF1ezapBlKcnjZ/DXZ2CsVhGTJRF8 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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