From patchwork Wed Mar 2 16:36:36 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: 12766302 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 A9CF4C4332F for ; Wed, 2 Mar 2022 16:39:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D67DC8D0008; Wed, 2 Mar 2022 11:39:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC6438D0001; Wed, 2 Mar 2022 11:39:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3F418D0008; Wed, 2 Mar 2022 11:39:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 9BE728D0001 for ; Wed, 2 Mar 2022 11:39:01 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 69CC424F29 for ; Wed, 2 Mar 2022 16:39:01 +0000 (UTC) X-FDA: 79200005682.12.6854D89 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf13.hostedemail.com (Postfix) with ESMTP id C67F620008 for ; Wed, 2 Mar 2022 16:39:00 +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=1646239139; 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=9LoFBOx+41NuRW+TN1sbV0xBqJ4TCv0zuyZEci6w9hM=; b=akh6ZCXAq6FQiLjzz0h/T1o90vGgV7kP6AJdUAegzuJcUmFmx91g40h8iMe6ExZqRMVg8R 8vORXjnqmTNanqHasHPqrgDKVLA2b5UP/6An2XkkoipMm/2RQn3mf4ibXNC/PyVtnaQaIe NfFWVZDuiLbt7SARW7bRtOptFFXS3RE= 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 16/22] kasan: move and simplify kasan_report_async Date: Wed, 2 Mar 2022 17:36:36 +0100 Message-Id: <52d942ef3ffd29bdfa225bbe8e327bc5bda7ab09.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: rspam11 X-Rspamd-Queue-Id: C67F620008 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=akh6ZCXA; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf13.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-Stat-Signature: ntuhkexs4h8zsxybg8ycqjs94538pbgb X-HE-Tag: 1646239140-112530 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 Place kasan_report_async() next to the other main reporting routines. Also simplify printed information. Signed-off-by: Andrey Konovalov --- mm/kasan/report.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 73348f83b813..162fd2d6209e 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -392,20 +392,6 @@ static bool report_enabled(void) return !test_and_set_bit(KASAN_BIT_REPORTED, &kasan_flags); } -#ifdef CONFIG_KASAN_HW_TAGS -void kasan_report_async(void) -{ - unsigned long flags; - - start_report(&flags, false); - pr_err("BUG: KASAN: invalid-access\n"); - pr_err("Asynchronous mode enabled: no access details available\n"); - pr_err("\n"); - dump_stack_lvl(KERN_ERR); - end_report(&flags, NULL); -} -#endif /* CONFIG_KASAN_HW_TAGS */ - static void print_report(struct kasan_access_info *info) { void *tagged_addr = info->access_addr; @@ -477,6 +463,20 @@ bool kasan_report(unsigned long addr, size_t size, bool is_write, return ret; } +#ifdef CONFIG_KASAN_HW_TAGS +void kasan_report_async(void) +{ + unsigned long flags; + + start_report(&flags, false); + pr_err("BUG: KASAN: invalid-access\n"); + pr_err("Asynchronous fault: no details available\n"); + pr_err("\n"); + dump_stack_lvl(KERN_ERR); + end_report(&flags, NULL); +} +#endif /* CONFIG_KASAN_HW_TAGS */ + #ifdef CONFIG_KASAN_INLINE /* * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high