From patchwork Wed Mar 2 16:36:30 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: 12766298 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 B1A88C433EF for ; Wed, 2 Mar 2022 16:38:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 095418D0005; Wed, 2 Mar 2022 11:38:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 01E958D0007; Wed, 2 Mar 2022 11:37:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E50328D0005; Wed, 2 Mar 2022 11:37:59 -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 B79738D0007 for ; Wed, 2 Mar 2022 11:37:59 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8F39B2119E for ; Wed, 2 Mar 2022 16:37:59 +0000 (UTC) X-FDA: 79200003078.04.219A216 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf19.hostedemail.com (Postfix) with ESMTP id 902651A001A for ; Wed, 2 Mar 2022 16:37:56 +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=1646239074; 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=4cKKYZ6rFTNdllIAOfnpLukoRzeAYo94WNiwHmUVtvE=; b=HVbToheIxR10VUP8ZlBKwBpe96+cP7ZagHwjrCt0/PJTSNJAVAmgv4JjI3toxGepTU/P+x kxBUHAO6r9T8Ca7DmIdW5ZyIoqecbSNt8eWrMkNdaBe81yZJigAWXY2dR1/2QfOthDk1I+ EZlcs8NWhHuUPzVWc6JhOYmxDyHVn4U= 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 10/22] kasan: move disable_trace_on_warning to start_report Date: Wed, 2 Mar 2022 17:36:30 +0100 Message-Id: <7c066c5de26234ad2cebdd931adfe437f8a95d58.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: 902651A001A X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=HVbToheI; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf19.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: 5ibswddng1gsq8qdim8x95kpk1qefbyz X-HE-Tag: 1646239076-158113 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 Move the disable_trace_on_warning() call, which enables the /proc/sys/kernel/traceoff_on_warning interface for KASAN bugs, to start_report(), so that it functions for all types of KASAN reports. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- mm/kasan/report.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 0b6c8a14f0ea..9286ff6ae1a7 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -129,6 +129,8 @@ static DEFINE_SPINLOCK(report_lock); static void start_report(unsigned long *flags, bool sync) { + /* Respect the /proc/sys/kernel/traceoff_on_warning interface. */ + disable_trace_on_warning(); /* Update status of the currently running KASAN test. */ update_kunit_status(sync); /* Make sure we don't end up in loop. */ @@ -421,7 +423,6 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write, void *untagged_addr; unsigned long flags; - disable_trace_on_warning(); start_report(&flags, true); tagged_addr = (void *)addr;