Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2433929rdb; Mon, 20 Nov 2023 10:35:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFInCNp+Hwjn/AeLhHdo3K1y3CyOVt5N/WazcwzyWnI+DbhINZaA0+j9hfKnPskZXuerREc X-Received: by 2002:a05:6808:1450:b0:3b7:673:8705 with SMTP id x16-20020a056808145000b003b706738705mr10041963oiv.18.1700505319853; Mon, 20 Nov 2023 10:35:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700505319; cv=none; d=google.com; s=arc-20160816; b=YwVfk3XrbFJqDd0LvV+sz02AO5yDCeKOPFbbkd8gqKHoXaNwbCMT7InDzBwcwvpnVi FIxAUnBemOfqtpEVLnJ1OIOqzqpdc1lLmYR3Lh3RKmjvXMPWyoKQHDTYZxoWkztKYlu0 uwToCFYQGpwnniy0e7Nd8jcHRPXNN484tCrs/N3Zs2ESGCjMrmo7C/qJdxsDjHS7DBz7 NuTCrrfAGauAB6z0Lg4hhvR28CMp5o+/jCb53nBuYkx//YGL1dEs7TaguS3wa/vPXqFJ evOCNdSrgRwuxcHUKl9e4B/FOgvfZVhnK/0hi8kYbmCIuRQBo57kOO6RPCrRDWUaEp0Z XV5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=Ndzzw2LDYk3UJM+5T71hG/B5zzIA5XjvqZzPCmRkAfA=; fh=ONqwzSuNvSIo96fWAp0pW54nN9xAdzTfApSlC7LEvRU=; b=lx9nlOaOPBNk62Q9t0Cz5ZIRWe+9zdvAHxfGviCP8k0VKJwyBDPXC9pTyfC8E5629/ N16LGPltR6q1y1cHBaTLM9XyyL4vxf2uwBgAVvs/qRZPTvgJkd7Uxmrq604LsyxHT7aL E4iY330xzvr32erzmM83xG0qfOy7vhzW+WJXUE7zTkvure4l7/YL3xOGiLMraCTEzojH Psv+H9A6WUOG0Od2KCnObkB3b2utnCZu71LBgPgCBrJ3H2DY06MnyDiPda08d7Kphyfg +D5RE083ZCs6hKcthbhuImR/XelMGVE4iCasMotCkNCBu5qa2HNbNy1KywSnUZwMTGvf AsXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Mc9ZBcq6; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=kW+Mms1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l5-20020a632505000000b005855f67e490si8739673pgl.690.2023.11.20.10.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 10:35:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Mc9ZBcq6; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=kW+Mms1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 415F980FA9E2; Mon, 20 Nov 2023 10:35:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232549AbjKTSfA (ORCPT + 99 others); Mon, 20 Nov 2023 13:35:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbjKTSeq (ORCPT ); Mon, 20 Nov 2023 13:34:46 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CBBECF; Mon, 20 Nov 2023 10:34:42 -0800 (PST) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: 0.04 X-Spamd-Result: default: False [0.04 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; MID_RHS_MATCH_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_RATELIMIT(0.00)[to_ip_from(RL563rtnmcmc9sawm86hmgtctc)]; BAYES_SPAM(3.84)[96.50%]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWELVE(0.00)[24]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[linux-foundation.org,gmail.com,linux.dev,google.com,arm.com,cmpxchg.org,kernel.org,chromium.org,kvack.org,vger.kernel.org,googlegroups.com,suse.cz]; RCVD_COUNT_TWO(0.00)[2]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 10:35:05 -0800 (PST) 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 --- 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); -- 2.42.1