Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29058315rwd; Wed, 5 Jul 2023 06:41:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUML+YEgPU6OSGomwy1LzRgQBL6phawcVCys6xgBqiH33OXdaygRkeilNPQbeCwVIEsMLU X-Received: by 2002:a05:6a21:78a6:b0:126:42ce:bd44 with SMTP id bf38-20020a056a2178a600b0012642cebd44mr3032387pzc.17.1688564501451; Wed, 05 Jul 2023 06:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688564501; cv=none; d=google.com; s=arc-20160816; b=Iy9+LRwH3robYgcWQreYA3/yxwSCoEL5ci7zMi3ZhcoQL4UFI70Kw6mPo62GeBse8e x+XEOAQQBEL/JmcT5rT9A47JXq5Qx7St4vHQdMcVbhMJpjC7V+G7Dp5AIOu+iv+r1y7M XuQRCrqiFFWwtdhsh/at4IteJGCUd0UXfobhoClQmhxgFU+DnpU95ZnPtaBRQFj+fSTJ Ai8CwU2TXfmVDdFqPSaethiZL72+LVqmVLZ2HgaHkVXNxC17nWzgJo7XJ8LVPkHEBtUG kdig1ySQNaMY97iMhuL9uloju7SeeW5r6M6I7SZBu/fTyqlMV38lrbzvuk9go6VXf+xc IpAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dHD+gumzoWP+nl3VtSqoKGEKW4lPTUyBTvzSxtXSgic=; fh=FLheBl7U4mnapEuAMbtrMgsVTss+N7v7WP+2Ls5tmtE=; b=yC07tKYjLXskNMrDsOH2NpNbH+QxAzCxHQ1liFq8zdMnh0TgSn/Dd96Rv9XqA5JdOn 87Xz4SjHirHgVOKtNs11E+kX9qMYq5ds2eqwQlj5UQT1Sb2MTondIcQrUOkiVFrLeIyd DyrRmNpkVzC9d1ASY2iTvWCXOb+giA/1eq8uTU+N+l2nY5zb2bWBmlJdDo8kNgR2fu8Y wuXpRNYe9Nm5gDDdJeDvz+kOS3Qw3BI1zZ2ZuM8Kt7BqoYFNEzEKYWwyPnrYYbXICx9H r+i+VwNdiv6ABTb/PXQPF9LMDrZohOrhSnz4tuPQbcqSqTuozrSvQZEGGE6TQDsnFqgP 32eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=asQQxGjG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020a631f1e000000b00544b88dda25si22011708pgf.64.2023.07.05.06.41.26; Wed, 05 Jul 2023 06:41:41 -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=@gmail.com header.s=20221208 header.b=asQQxGjG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbjGENTZ (ORCPT + 99 others); Wed, 5 Jul 2023 09:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbjGENTU (ORCPT ); Wed, 5 Jul 2023 09:19:20 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2891713; Wed, 5 Jul 2023 06:19:20 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1b8a8154f9cso5217455ad.1; Wed, 05 Jul 2023 06:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688563159; x=1691155159; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dHD+gumzoWP+nl3VtSqoKGEKW4lPTUyBTvzSxtXSgic=; b=asQQxGjGoyEoGcp0NIF7Aq/cB3t8GLX4OuYOJWGn/pxr5hkHba1+Vtu62kNUqA3ANS cbt3exB8yJCokdcq3izXIcpAt6HmIxDv7B7EUBfJLMFm6a5y9kLjSMQdA5t7Ud/jGXsM 8bNCd8+pnLMgVeuQystG16cJbyHeoNl0grbUkXBgLveBWatIchIPKk0ARqfT4jxJnYXM EfqwIZ59JOWRep7p1bT0wZBk4wQB9T1Xg5XdQbWHg0wztHBylfFnLMMJVPHeRDdlDDiK vxc5RCHbyVuf4onWIeE9whQt2lTa/Cu621QMa5e3sEOW16rXVPIb4VmCPwI1xfB/P7Mm mZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688563159; x=1691155159; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dHD+gumzoWP+nl3VtSqoKGEKW4lPTUyBTvzSxtXSgic=; b=dLZb0DPkmiTJlx/2AvR1aQIYCcykfSESDhLjz994jjOPDNPR+1eKke9Vvo+EGEMq2K Er0HbV8zxhttjP2bzVMcNHLFtc//5Am9BnrUlDtNVzAu0NSFbE96MloLXvBSNuPrU9Hz ULXh8+UFEP6QGMJSoHtA0sZ7R002FqZuvs67vWhtDo7E+rK9GEb21qj52FY+XfpbRLsW wvcR92zaVI56cENLhwQ+cXp9l4UkuVv1w19dlsRC5TPTjz2oz4BOe4qQ/V+iQFD9o1iR t7cbTeoqJm7MJySmAirT7DkMl6GxeqtkfxCZZxxS755o3S7Hj9ZMR67b8y1RvN5fDHqs xOiw== X-Gm-Message-State: ABy/qLb2AtSSonTkzXZRnw0dKFc8E25FTvtZpTX+1P2/WjC2LFKm3INE P9K2P7t4WC8X6I2MD1kPtvgZ0PsE8czP7OPwa7o= X-Received: by 2002:a17:903:228d:b0:1b8:8d48:958d with SMTP id b13-20020a170903228d00b001b88d48958dmr3547209plh.1.1688563157269; Wed, 05 Jul 2023 06:19:17 -0700 (PDT) MIME-Version: 1.0 References: <678ac92ab790dba9198f9ca14f405651b97c8502.1688561016.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Wed, 5 Jul 2023 15:19:06 +0200 Message-ID: Subject: Re: [PATCH] kasan, slub: fix HW_TAGS zeroing with slub_debug To: Marco Elver Cc: 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 , Will Deacon Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 5, 2023 at 2:51=E2=80=AFPM 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 initializin= g > > the object via its built-in memory initialization feature. Even though > > HW_TAGS KASAN memory initialization contains special memory initializat= ion > > handling for when slub_debug is enabled, it does not account for in-obj= ect > > 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_d= ebug > > is enabled altogether. Implement this by moving the __slub_debug_enable= d > > 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!