From patchwork Wed Mar 2 16:36:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12766293 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77C30C433EF for ; Wed, 2 Mar 2022 16:37:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E3428D0002; Wed, 2 Mar 2022 11:37:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 092D08D0001; Wed, 2 Mar 2022 11:37:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEB608D0002; Wed, 2 Mar 2022 11:37:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id DBF428D0001 for ; Wed, 2 Mar 2022 11:37:53 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ACB00181CB2B3 for ; Wed, 2 Mar 2022 16:37:53 +0000 (UTC) X-FDA: 79200002826.23.2B55474 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf27.hostedemail.com (Postfix) with ESMTP id 1ED3F40006 for ; Wed, 2 Mar 2022 16:37:52 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1646239072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I05J+o+7HT6Q0jFo6xpWdgjFaYldkohtghm32sfnKb0=; b=EoZSAVxP43kd9ROACbNMePuzm1dcn+XXaWMyw5ByZ/ttIEznjWnvjbWO0dH1GvTwB4McX2 /2JSo4+MY3aZM3Dozy0YXIjTDH8PVgk+iIZXPfy/fkQnDliZIfQGZae3tuP+/dvC8GtBfz Mqgr+ukf08BswObNocR5H/yHe/qOgnw= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 06/22] kasan: simplify async check in end_report Date: Wed, 2 Mar 2022 17:36:26 +0100 Message-Id: <1c8ce43f97300300e62c941181afa2eb738965c5.1646237226.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1ED3F40006 X-Stat-Signature: sua593qg9tcdy4cfgx7f4kukp7uoxr1z Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=EoZSAVxP; spf=pass (imf27.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspam-User: X-HE-Tag: 1646239072-104851 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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); pr_err("==================================================================\n"); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);