Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3424609pxp; Tue, 8 Mar 2022 14:11:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2ma/pcevnMU0AQA0mMen7NIh7Rly6bnv7FajLKkLaAPVe4X0I3Pr43jjUGaIxP/Z0hHsT X-Received: by 2002:a17:907:94cb:b0:6da:8e01:8312 with SMTP id dn11-20020a17090794cb00b006da8e018312mr14472082ejc.7.1646777516132; Tue, 08 Mar 2022 14:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646777516; cv=none; d=google.com; s=arc-20160816; b=AIO7IgyLZ3hT4HmWlplnLrCCUEEBgV7kXywgAKobPOBXfxejL54MVrQxOFWdsBZPVl W/ykx10zgOszOLx6gqXrIqb9MceaphKGjiiEvgV4MGRENgp0+431/HA55qYYH02PuQdu RoTG8Wrnwk+LWNWvPd/hduSZRUqwkiuekckZxTYpw/92gneiVmvWbvKGYgEtbzrzJlN7 3ORSRraGrv2aUDDyVFFqlRAG2iKcQLme2O9VdahJ9WmLXQR0+tktbJcYOq9IdC6uCf+X u3ANknkyjWtslSORx7JbFYi9+B65wfGAe/UJco6sXYshqPdiqV8pbhPVHpIxAdm7/xzm EabA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hRpJxORzYHfHsib6XQ7pADNjcahneCQRQX9w7pOY0OQ=; b=F+s2scBEbPVXg3ZhD6WcLgsZYlsO9WtqbfvfNNmjbVxcYvcqQvYO22QquZIbwkd6SS cLfXRH1n1rM+zDSIRXdmQtYCUTNXGmTOV5m1JDaJAUtdy4gGeMiOLes+kUJES66P2guw sihNKWNRA0jdDyhnVv7pO3BFpIMXq76vN4QCoJ3xBFTc+u/XUtj2XaNLdkoMmn1jGNlv ChyahG9R+qclndmlq169/ZXH3e8NDx8Qq4LU0psaRaYTbxinUvJ2qrS23h83SJR9rTpx 6UHVH3AYiwrFjuvzWQlkbX+q1lVlFvpujZBzJ3AE+d0w3GNzU0BTcjqJADAWT4h1YDKy Tb6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eYia2Unk; 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 m4-20020a170906160400b006d1cb1ed158si57058ejd.175.2022.03.08.14.11.33; Tue, 08 Mar 2022 14:11:56 -0800 (PST) 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=20210112 header.b=eYia2Unk; 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 S1345146AbiCHOKm (ORCPT + 99 others); Tue, 8 Mar 2022 09:10:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237849AbiCHOKl (ORCPT ); Tue, 8 Mar 2022 09:10:41 -0500 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCA5D4A938 for ; Tue, 8 Mar 2022 06:09:44 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id e22so8733403ioe.11 for ; Tue, 08 Mar 2022 06:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hRpJxORzYHfHsib6XQ7pADNjcahneCQRQX9w7pOY0OQ=; b=eYia2UnkUujMkCrYJE7d89YSUEUoxjnvl5UJEuhavn8d1SEmdyr42GRkIEpcHs7myn pN7VYwTutC7jPYkkMhURoI0yONVTY7jxIPfG8MzdMeCR/7TLVUSC31QR4MQq0yaEJc4m v7pl2GcX78WMtKLSqP3Ya65hsfztUJWVkgWdToaDHtYxmMGL/9d2Fv+3WRcprLBlJ1qk hIGBxkEi34GmItstGIkhdUHPzOBsSYSs9iZ69kpdp8pSsB9BH4y+IRSB4V4C36SjP0dK TmlMqOYK6VZY8GM5a8+sq+PGtpVnyOr+ttU52Hea0UkXgSVGZ4tmtMoOrO4RXpegyqDF RkqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hRpJxORzYHfHsib6XQ7pADNjcahneCQRQX9w7pOY0OQ=; b=GGGzo3SnY33mPc+8T++nPL16COwslmGKzz8a4WkT/iPF96BawMORixTGCuoWa1dGFq xR/UOXo8Mi5d+9V77aXbjk1B5rcgqQrXwKBx5vMztyK2w+CjsruHBl+scf95KQeBP9RW CN66kfVKqHm8NYJJsnz7uaztU4dGKdz0/B9ootBUc8paSnnhNckfqo2u/4eg6y7hORL/ UBonf7YkPb89mkbRry7+jDigTI3Vr/pD5ARoSUNnuWHOhZQ/PAB9kna3+7B96+DJwkL3 VS1CxZ6OtEREnW+COEjQKJ1avfWNrk9yYS+w02gyOtAPvFogzBwG9SNGUZi4Hs8TsxJX 6vCw== X-Gm-Message-State: AOAM5300nOGiAuUJaPSJqK5yysjl+lsG2xU7a1a0ETMmB5r7BRzrLiyG SaPP5EQKO1khMI5sMVwu1/w0f5DudoyVxTPzS75ZGY3I X-Received: by 2002:a05:6602:490:b0:638:c8ed:1e38 with SMTP id y16-20020a056602049000b00638c8ed1e38mr14813042iov.202.1646748584377; Tue, 08 Mar 2022 06:09:44 -0800 (PST) MIME-Version: 1.0 References: <1c8ce43f97300300e62c941181afa2eb738965c5.1646237226.git.andreyknvl@google.com> In-Reply-To: From: Andrey Konovalov Date: Tue, 8 Mar 2022 15:09:33 +0100 Message-ID: Subject: Re: [PATCH mm 06/22] kasan: simplify async check in end_report To: Alexander Potapenko Cc: andrey.konovalov@linux.dev, Marco Elver , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Andrew Morton , Linux Memory Management List , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" 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, Mar 2, 2022 at 6:38 PM Alexander Potapenko wrote: > > > > On Wed, Mar 2, 2022 at 5:37 PM wrote: >> >> From: Andrey Konovalov >> >> Currently, end_report() does not call trace_error_report_end() for bugs >> detected in either async or asymm mode (when kasan_async_fault_possible() >> returns true), as the address of the bad access might be unknown. >> >> However, for asymm mode, the address is known for faults triggered by >> read operations. >> >> Instead of using kasan_async_fault_possible(), simply check that >> the addr is not NULL when calling trace_error_report_end(). >> >> Signed-off-by: Andrey Konovalov >> --- >> mm/kasan/report.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >> index d60ee8b81e2b..2d892ec050be 100644 >> --- a/mm/kasan/report.c >> +++ b/mm/kasan/report.c >> @@ -112,7 +112,7 @@ static void start_report(unsigned long *flags) >> >> static void end_report(unsigned long *flags, unsigned long addr) >> { >> - if (!kasan_async_fault_possible()) >> + if (addr) >> trace_error_report_end(ERROR_DETECTOR_KASAN, addr); > > > What happens in the case of a NULL dereference? Don't we want to trigger the tracepoint as well? A NULL pointer dereference is never reported through KASAN: for software modes, it triggers a GPF when accessing shadow, and for HW_TAGS, it takes precedence over a tag mismatch. Thanks!