Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2149476rwp; Fri, 14 Jul 2023 01:16:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZlk3wayNpqcIzGarc+9Qe2XnmXYrDmqFc3UOGnXYmCw5umWNAAG7Jf6nO4+S9+LKvxH2r X-Received: by 2002:a17:906:3090:b0:994:542c:8718 with SMTP id 16-20020a170906309000b00994542c8718mr238864ejv.76.1689322604451; Fri, 14 Jul 2023 01:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689322604; cv=none; d=google.com; s=arc-20160816; b=cysq75jKyIqRoh0kdmUVECa6dohtk44cJZtOkK/icFEa+UZbrtsfo3aK6Azr0Nr3iH hyQe0EhyASqXOzSTAek2zCSJ+xVGbV5qtUsm3Vf/N3eRbgWk+mdb4UYXcZEt/+JXhT6Z sx7uVFZP7HaI2IPJ1ibqLaNbq3E/r5L4yljC1KhYdDQXe5L2F/IeU9wG+qi/aFG4C2n2 5ueehJo6wSMvO+xYoh6e5TclT9R+e6FrJXVf/ZM+5+Dxbm8+wkBgCgmetwui0EVPg+9r Ofjy0vax9NKDDwcXhtlWTwOluHppX6eB9FQabXhXtKyuCMCCz2cQZ1+5n/TNgDHsfbhl 0Oag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:from:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-signature; bh=Q8U17kbz9Qkptcs1GwSYT3csRlRYjC4fhM5H0d02U/E=; fh=m6I1Pql7K94sY7FiQBH0Wk1yFjG2FUZUwPXu2sjjSLg=; b=qPhH07r9ihjYT4knxw+KRsojbQQWSsmLLIwN5GrLodxedrANzr3qsECLvOzo3p3gGP v1BQxYdcQQXDAlQijDhgLBp13dyA8XDG++FaAeFtBLsBW5WqAD/c0DPTt9SXBtKqhOnY i71jLtNCpu0qTRXyZEeeMjd2cd8VCcU08Sq+2I5oWyvFNauXeRJHFzEIeybPYdICnjRG Yen2JbL6ooYl/sMSbjzED30q9WPWlO7OIzw3XtSsfGfpL1Ko5fjDjSKY8+lO8Kuh6/WU 8+9VVpIKIn9skZ8xxcfyIE7UCwqCkcMe8LEbZjA9nYFuwOqJyIkkqScWWNpWUE1NP78O AkeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=odJB0X3q; dkim=neutral (no key) header.i=@suse.cz header.b=aQQaKGxc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a170906939400b0098df2c99726si1040136ejx.147.2023.07.14.01.16.20; Fri, 14 Jul 2023 01:16:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=odJB0X3q; dkim=neutral (no key) header.i=@suse.cz header.b=aQQaKGxc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbjGNIEE (ORCPT + 99 others); Fri, 14 Jul 2023 04:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235264AbjGNIDi (ORCPT ); Fri, 14 Jul 2023 04:03:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E98563C1F; Fri, 14 Jul 2023 01:01:17 -0700 (PDT) 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-out2.suse.de (Postfix) with ESMTPS id 843231FD8E; Fri, 14 Jul 2023 08:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1689321676; 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=Q8U17kbz9Qkptcs1GwSYT3csRlRYjC4fhM5H0d02U/E=; b=odJB0X3qOZtM7xGukmtCbfRh9tQcXwNUCh9xJy4OArvO5BukiOADI4s2idS1syBbnam+zD lxM+AW7ZV44CSH2OfWt/HqRBVGBYbjc23WFlgJKVwi30/2qgAuciKunAbz+0yZjcXABs2k Gz5+uU4OkOrF2XIoQ5OGsLiIfkH0Urg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1689321676; 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=Q8U17kbz9Qkptcs1GwSYT3csRlRYjC4fhM5H0d02U/E=; b=aQQaKGxcoITzKyKP44+lF3oiDzLXl6huK7wAVryUOU7dge/jmHI5/IDab+h8UHpYUQ+8+C iLYe1lUDzp8idCDQ== 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 4513513A15; Fri, 14 Jul 2023 08:01:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KeAdEMwAsWQDSAAAMHmgww (envelope-from ); Fri, 14 Jul 2023 08:01:16 +0000 Message-ID: <7c33a6c3-4ded-e0e4-820d-ffc337da9800@suse.cz> Date: Fri, 14 Jul 2023 10:01:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 2/2] mm/slub: remove freelist_dereference() From: Vlastimil Babka To: Kees Cook Cc: Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, Matteo Rizzo , Jann Horn , Andrey Konovalov , Marco Elver , Alexander Potapenko , kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org References: <20230711134623.12695-3-vbabka@suse.cz> <20230711134623.12695-4-vbabka@suse.cz> <202307110917.DEED145F0@keescook> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 7/13/23 09:44, Vlastimil Babka wrote: > On 7/11/23 18:21, Kees Cook wrote: >> On Tue, Jul 11, 2023 at 03:46:25PM +0200, Vlastimil Babka wrote: >>> >>> #ifndef CONFIG_SLUB_TINY >>> -- >>> 2.41.0 >>> >> >> I like reducing the complexity here, but I find dropping the "object" >> reassignment makes this a bit harder to read. What about: > > Alright. > >> object = kasan_reset_tag(object); >> unsigned long ptr_addr = (unsigned long)object + s->offset; >> freeptr_t p = *(freeptr_t *)(ptr_addr); > > Are we really so benevolent with declaration-after-statement now? :) I've left the declarations separate for now so it's similar to get_freepointer_safe(). Pushed the result to slab/for-6.6/cleanup and for-next. Thanks for the reviews! >> return freelist_ptr_decode(s, p, ptr_addr); >> >> ? >> >> They're the same result, so either way: >> >> Acked-by: Kees Cook >> >