From patchwork Mon Nov 20 18:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13461875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01D1FC197A0 for ; Mon, 20 Nov 2023 18:34:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30F536B03A0; Mon, 20 Nov 2023 13:34:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 202106B0398; Mon, 20 Nov 2023 13:34:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C07186B0394; Mon, 20 Nov 2023 13:34:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 890EB6B0394 for ; Mon, 20 Nov 2023 13:34:44 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5A75F40A18 for ; Mon, 20 Nov 2023 18:34:44 +0000 (UTC) X-FDA: 81479183688.13.29E9058 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf02.hostedemail.com (Postfix) with ESMTP id 3D99880022 for ; Mon, 20 Nov 2023 18:34:41 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Mc9ZBcq6; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=kW+Mms1d; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700505282; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ndzzw2LDYk3UJM+5T71hG/B5zzIA5XjvqZzPCmRkAfA=; b=OlRZYEepboJ2i162uuWl3DVIZ+iWR1/meSX0XByQqxI42pjkGOnbbCCH8O8tZ5B9YN/mTa Js/OArNHF181U6FzUJj0Gg9Du1t+Q0GQrHMoYlojp9KiuyMmufMsTcSxzXiRqlmecmW76W R/q0O8C9w39oVsLknj8Nhf9bkHKDe18= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700505282; a=rsa-sha256; cv=none; b=jXEJJjz8Cj/4sJkqp5B1FshFxSctzcUYF5dea+scurFCATCSV1mxhKzlgGLhMRxIk2ueOz 8IkSqU/cwHO57c0wLqX2z0xguKu3M9rWEvxF0TxkOkYZ5PmrooPimD+pohcHQ7kjKO4YJ2 S0NYVCrTpb05zNaT3ylH1T5xTLRV3R0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Mc9ZBcq6; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=kW+Mms1d; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 80D1221910; Mon, 20 Nov 2023 18:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1700505280; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ndzzw2LDYk3UJM+5T71hG/B5zzIA5XjvqZzPCmRkAfA=; b=Mc9ZBcq6Spfg9QwedmGPyo/dMCNG1JY1076/wyUH1iFaMU1tu9crKcZYwQHKDKjIGk4S4T m6dHRlGeBu/9w/NM0AnWURFTZXr7u1aMPf4dEdhYPFHoc+EEQpGKWmfwmUfPzqvAktN0sy frRVzY7TeUVAmxQda/UEPOzS0MEsTCs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1700505280; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ndzzw2LDYk3UJM+5T71hG/B5zzIA5XjvqZzPCmRkAfA=; b=kW+Mms1dlJceZl3bnGtrtmPgemcedujMb5K9V3+HZc17ZDdiazJ24xOeJrQbhgaoOsMOiX Ze4KskyfWaxP4UBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3D2A713912; Mon, 20 Nov 2023 18:34:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IIxyDsCmW2UUMgAAMHmgww (envelope-from ); Mon, 20 Nov 2023 18:34:40 +0000 From: Vlastimil Babka Date: Mon, 20 Nov 2023 19:34:15 +0100 Subject: [PATCH v2 04/21] KFENCE: cleanup kfence_guarded_alloc() after CONFIG_SLAB removal MIME-Version: 1.0 Message-Id: <20231120-slab-remove-slab-v2-4-9c9c70177183@suse.cz> References: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> In-Reply-To: <20231120-slab-remove-slab-v2-0-9c9c70177183@suse.cz> To: David Rientjes , Christoph Lameter , Pekka Enberg , Joonsoo Kim Cc: Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Kees Cook , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, linux-hardening@vger.kernel.org, Vlastimil Babka X-Mailer: b4 0.12.4 X-Rspamd-Queue-Id: 3D99880022 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: syun3p7k4hid8uhejnqewobcoo4twfby X-HE-Tag: 1700505281-111553 X-HE-Meta: U2FsdGVkX1/3yioDXe7SX1eEosAzmSaA/aZUHJ9V2TnsPvF1UxCVIxS6su4umlMKU4w+6900towB7v+50Q7aG52bk7f5ptOGguxIxJF4GJlFtblzAJwE/GNRpxSNYp8WAy4Co4pwrQtY/klOguVNOnmRTaHMRz/3Ndq0aX0wXakDc9Fi1A5HVEFZPiCSs0bBrd1dnbWWjslBTIkjbjJw9aTum6mNhnqZQnAHvEcaP2HeKmPEpVrzPSMU18HKzyxeQh4oNiGHNeL/Fk7m9VFYyd9BM0F+SwYmQwuMUEuAeXZiIkKTRGsxbdhwlNiMS/pCsQNU9MgIB28C8xXaAKAysgxeBwCCYSeymOLJ8fcajzpWcGjMi/3YxmBCDb7Rx4usraHI4GWHWz8Rr30DMV606E+aGTapY48tRzyisaoxvhH8PjNSKzOSSD6xClsotTIQqKGa7emrozjIaWbzLxB8bR+peb/wZOlbpLlZOtAGV56b92NE/eKQV0Gf5qEV3wqO08iQJI08Zs9tbGv7fW1a8JfSQ9LRO+sWEWTEZ3TZFg92OgB33LBEcSSNzV0AfdtkTTbn8qU59B8jGBUoLHIWHO1C/+rrvgWWKI5qO3TjUHKl+AiIfYOJRA66yk3obbn9Ge7vuSY2RkcS+dx2y/MVMR9dWHpQABucrfPlCILNQNeKty6bjMweyZY4jQPLzxilXvmjT+Q/5JBkj9olR5TNyjJxxgEHhfeNracQpezv0TKI6JjquoM6oOaV3gB6dA+qmmQr+7NaWfBaMmsqsl6k5kHcVVMqrt0rSFDOSc8T45rwFXYReGD/uHjOmEh64pH31Vm5sE/Rid/d3QznkQq4ooexKJwnNDPHMxYUrQPHm/wMf0F8662+4lfFJU15OraB0IiibqXFBA9SoMwCOdxOiTJihOsqaEPndQenZM/N+onC0zbsB9nlMzM2hXNeE31PGdTrEVSdkcp6cssbai3 Un4z7nzE npJi5ECOHxvf99Qjl+5AS0N8YAJhmf+1SXHC5EVP3l95UooXyeyVEImU54J79egord//jaaY2JaWhQfW+Bhv7sDKPbKOzB8ztfD6dtBy6xpsPKVm2VDtIxZSwcf2XGm8sEsNl9DFCN9EgDvnMQfSWl+DEquOnr1ti77JZ6TzP0ED3hJA236tZ0hVSm6J7Q+IwENNIYdCiD1p7Zf4uTtGG8Bqt2/28cIcL26JRNLXjAhhR15KGfJ0pxysFHKekJD6MqzIDJae/RhzHDiCrWr/+dS6OQw8S+/JcRIw5x/Tp5J85aO8C+kKTaHNc+qIPO3q/nhalvRgLHFth7EYpluhzHrSTUMvHjIMxupGZDn2rQBDX8KVlpW+yX5/WnNILXBapU/7TR+KCPTsHO+h269XKCWBfsg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Some struct slab fields are initialized differently for SLAB and SLUB so we can simplify with SLUB being the only remaining allocator. Reviewed-by: Kees Cook Reviewed-by: Marco Elver Signed-off-by: Vlastimil Babka Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/kfence/core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 3872528d0963..8350f5c06f2e 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -463,11 +463,7 @@ static void *kfence_guarded_alloc(struct kmem_cache *cache, size_t size, gfp_t g /* Set required slab fields. */ slab = virt_to_slab((void *)meta->addr); slab->slab_cache = cache; -#if defined(CONFIG_SLUB) slab->objects = 1; -#elif defined(CONFIG_SLAB) - slab->s_mem = addr; -#endif /* Memory initialization. */ set_canary(meta);