Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30231854rwd; Thu, 6 Jul 2023 02:54:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQSKp/ZsHtNrLDaR9s8WRid+dQsJNcxE7ZsQd0SlzRUet/Z1ydPqbT9U6b5quj9lVjGXgD X-Received: by 2002:a17:90b:4c4f:b0:263:72fe:3ef7 with SMTP id np15-20020a17090b4c4f00b0026372fe3ef7mr1145149pjb.42.1688637290631; Thu, 06 Jul 2023 02:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688637290; cv=none; d=google.com; s=arc-20160816; b=fsAq/thKdhnvqtMbb8+nv3dMFtoZN2gylxMfaKChxujy1Q2elyeBOqxWBmwOy/glLY U0zNzBmUNQITsPxHQMVwa6iLBwbL2p/sB+cNg6n30snIo7eFWcHHmykzk63twsVrVSu5 y/hOwIRh3xQBEWbMcF/tC+WOzGAghS9cuZoEDNayxXwGbDBgvqe7OTZj4SlFOt5ee/px KYw9t7gszzM8RJdnX/aMFhRjWalJGfbc0wiAasTw3WK+STSnddnJXDmgsAGSW/aWyMXA 2e/0HLNcaU4vqvPlvBbuHmJqgwgOLXYCQ6DDsp3h9f32AbHsaVCWARbR5Na3Y+4wHkcA RDPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aR7wzPTAeYXclNZiycSvdfYf/LLIfVq6+SCpN6+MKFo=; fh=kjNqJjZQxZ7McQkFUg/p0a124a1y1npHY6ij6kne6Po=; b=yjM0vovZiodmJw7mpX+xlOnjFHkFlOip1N2/k+Fo8wb/cC7wyXEwdzVCfyOeVReCiF HeYYBgVkp8Ykfq3ivHPWlhh0EguklzQd4b4iWKY0gyTLlZhnDb+61p5wY631GK9PQYoI 7NqH26VbOxGyYAFgi9etyBY6wKeY8nRQ/mJpDG1ORU8jb685oLMquvI1FpTpfMy4bmpB kZKnHDr9ddlXhxikPUtbGoiQRyjo18yzH1vAfuFGFBhLiWvCh4+emd9OU6+dBrRs6ZE4 ukYdmb2HUwAFKBfK6/QRtuB0ePiFxCSEB/vxEgkpNQK8c0MNxaA6/CkT0HYk1NgoIAmi M3vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rePQVRdZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a17090adc1000b00263c4af4d8csi3407330pjv.121.2023.07.06.02.54.38; Thu, 06 Jul 2023 02:54:50 -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=@kernel.org header.s=k20201202 header.b=rePQVRdZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbjGFJDY (ORCPT + 99 others); Thu, 6 Jul 2023 05:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231792AbjGFJDW (ORCPT ); Thu, 6 Jul 2023 05:03:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A49521BEF; Thu, 6 Jul 2023 02:03:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1366618DF; Thu, 6 Jul 2023 09:03:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41383C433C7; Thu, 6 Jul 2023 09:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688634198; bh=bmwwx7MjhCs2MPk4U/hPy8kwH4tv1b3uF0aXE+oLbb0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rePQVRdZmjcVnVcq1mHjiOroIGXiH3oYyuWThaMD2WQeB71LFBFpa2j4YfrDJPHEC h7z0g5Tz87cgyToAwg+w+Bcq1grii82C1d3LMdZcAiQ6yn6Q5Or2w1zzEJkZJrauHz Xjw2T+I18zZp47PdFGybzj3x9sDPVUYLHxKRIN7gSUm/CndlzDEPnrAWuHadXl017s TObQ3QLjYmNr8URSi17mrIPe9U0zhoPK3fBYb8/f0xANq78axUcRll6xLjwx5OqFVX s6IQlHfx+YgT9Y6xFjQD1WEDk4v34iW1bztiwpUAUHDxJFyXOv98Mqh2ukkgNWSh0v PCu6aRF4xOLxw== Date: Thu, 6 Jul 2023 10:03:10 +0100 From: Will Deacon To: Andrey Konovalov Cc: Marco Elver , andrey.konovalov@linux.dev, Mark Rutland , 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 , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH] kasan, slub: fix HW_TAGS zeroing with slub_debug Message-ID: <20230706090309.GA29243@willie-the-truck> References: <678ac92ab790dba9198f9ca14f405651b97c8502.1688561016.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 On Wed, Jul 05, 2023 at 03:19:06PM +0200, Andrey Konovalov wrote: > On Wed, Jul 5, 2023 at 2:51 PM Marco Elver wrote: > > > > On Wed, 5 Jul 2023 at 14:44, 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 > > > > Is it fixing this issue: > > > > https://lore.kernel.org/all/20230628154714.GB22090@willie-the-truck/ > > Yes, my bad, messed up the Reported-by tag. The correct one should be: > > Reported-by: Will Deacon > > > Other than the question above, it looks sane: > > > > Acked-by: Marco Elver > > Thank you, Marco! Cheers, this seems to fix the splats for me: Tested-by: Will Deacon Will