Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35146088rwd; Mon, 10 Jul 2023 03:19:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnK1FX3Mr1R5YlrJ+oIklkeJ411ynzrCSltLSBYiF+qeaMoJ8N0Tw4A7BRKoyletu9PqGW X-Received: by 2002:a17:902:c410:b0:1b8:c828:f742 with SMTP id k16-20020a170902c41000b001b8c828f742mr14543884plk.14.1688984364361; Mon, 10 Jul 2023 03:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688984364; cv=none; d=google.com; s=arc-20160816; b=kGPgKyyVT9A7Rhme7u972jlyHmj+Th/SfBhqZAMwP5jsbDLGRIADDwmR5CyFfc6jun Rsa6SZ79xTpdKykbibTT00z6VJ8cRjeFcKVN1kneL/oO1jmPVjobMAhAYffvwgaGdiSq 7ZhCvKt6Rtd4cURfGC3HWvtgqnN96Wh8LGP8WpRaSkb2AAUVAummbxym2LrWg1oOi4rs resf4zowPSItNDgP69t/AtXpI/5Ukh5k1tUnA5I5ICwMwx7CVNXQYKkGkEB0nYgND+jz m3ODg62bamXGcFjUd7mSfSZY3yxK9JVt6y10n/w5Eh7mxMatE9N9T2LBG8D/yMhu6e/r rAqA== 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:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=JhQYnd3zFReOIgvPmbBH7euJHgaFU8/SGouVRAGqJOg=; fh=IrI/n/gkqIRJEvv5dkVbr4RFMyZ5dUl3kTv7gxKjtGo=; b=WIIadChvKB7sRT/j+yGrzMmJFiUQYztGTin8iOqvOdsjOQbMvAxgtp5Ym/+yTFxCRE 3orf7SdYtrEE4beRRz95zApj73DiR/eABGSKaKUE4lbOpSHiYnlkw81XO/Qg13UH7v93 5lQ3I4I2pm20NGJkt6xDFg9slYpYPkF83z29gOR6m5eotiIQcIu9LFIxDFQANoNQDKP1 Z6mdhHnp8AeC55pcx8/f9S0NfB/qsOA+6I8ri+XUy4Szg3BI1jCWRjerwTxYJL/h7tWD qdROPAzuXDE5rkG95QJFk1kj8SuSvOykX05B6HJDZLyw2Poj0UC9M7RsXn1vYYugdgLE BmKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=xz6F2AKC; dkim=neutral (no key) header.i=@suse.cz header.b=KxXe2n8v; 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 k3-20020a170902e90300b001b8bb836d45si3173947pld.69.2023.07.10.03.19.12; Mon, 10 Jul 2023 03:19:24 -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=xz6F2AKC; dkim=neutral (no key) header.i=@suse.cz header.b=KxXe2n8v; 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 S230132AbjGJJ62 (ORCPT + 99 others); Mon, 10 Jul 2023 05:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbjGJJ5o (ORCPT ); Mon, 10 Jul 2023 05:57:44 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545C230D7; Mon, 10 Jul 2023 02:54: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-out1.suse.de (Postfix) with ESMTPS id 31F6021EEF; Mon, 10 Jul 2023 09:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1688982821; 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=JhQYnd3zFReOIgvPmbBH7euJHgaFU8/SGouVRAGqJOg=; b=xz6F2AKCngY8+kyCyaqPfEcdl/9pcM3qK2zlApTNfnsSSmRxVEU3rLnQFOr3wfH41rieYI sRPfjnTsRQvKqbS2pAKF3aE+T5KN5gJtoCEawvbbRLMT/seMfiZl2ioO8QBxA7eakSAUlQ +z0vApCAa2POQfyJ1ZHAR018OicX224= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1688982821; 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=JhQYnd3zFReOIgvPmbBH7euJHgaFU8/SGouVRAGqJOg=; b=KxXe2n8vEXVhRArC1cbLwHAKno2ehlhMjN3Il+S6ofIu33K36fXvi3jmMrt+MwzWVdECPY zFnWDd0kaYFTx7Dw== 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 5A11213A05; Mon, 10 Jul 2023 09:53:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wcRGFSTVq2SsNAAAMHmgww (envelope-from ); Mon, 10 Jul 2023 09:53:40 +0000 Message-ID: <71313e6c-79d5-3ff7-981e-f7675aee0a5c@suse.cz> Date: Mon, 10 Jul 2023 11:53:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] kasan, slub: fix HW_TAGS zeroing with slub_debug To: andrey.konovalov@linux.dev, Marco Elver , Mark Rutland Cc: Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Vincenzo Frascino , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, Catalin Marinas , Peter Collingbourne , Feng Tang , stable@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-kernel@vger.kernel.org, Andrey Konovalov References: <678ac92ab790dba9198f9ca14f405651b97c8502.1688561016.git.andreyknvl@google.com> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <678ac92ab790dba9198f9ca14f405651b97c8502.1688561016.git.andreyknvl@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE, T_SPF_HELO_TEMPERROR autolearn=no 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/5/23 14:44, andrey.konovalov@linux.dev wrote: > From: Andrey Konovalov > > Commit 946fa0dbf2d8 ("mm/slub: extend redzone check to extra allocated > kmalloc space than requested") added precise kmalloc redzone poisoning > to the slub_debug functionality. > > However, this commit didn't account for HW_TAGS KASAN fully initializing > the object via its built-in memory initialization feature. Even though > HW_TAGS KASAN memory initialization contains special memory initialization > handling for when slub_debug is enabled, it does not account for in-object > slub_debug redzones. As a result, HW_TAGS KASAN can overwrite these > redzones and cause false-positive slub_debug reports. > > To fix the issue, avoid HW_TAGS KASAN memory initialization when slub_debug > is enabled altogether. Implement this by moving the __slub_debug_enabled > check to slab_post_alloc_hook. Common slab code seems like a more > appropriate place for a slub_debug check anyway. > > Fixes: 946fa0dbf2d8 ("mm/slub: extend redzone check to extra allocated kmalloc space than requested") > Cc: > Reported-by: Mark Rutland > Signed-off-by: Andrey Konovalov Acked-by: Vlastimil Babka Thanks!