From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF6EAC001B0 for ; Fri, 14 Jul 2023 08:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235097AbjGNIED (ORCPT ); Fri, 14 Jul 2023 04:04:03 -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 Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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 >> >