Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2674708pxb; Mon, 31 Jan 2022 01:36:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGfSUWLbDDoevdZSkgdvA9Tl0DH/q4CAWJ8CtnidNu+GGy9MsZKsZXQdLkKZJvOYS4BpJo X-Received: by 2002:a17:902:70cb:: with SMTP id l11mr19760763plt.128.1643621772414; Mon, 31 Jan 2022 01:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643621772; cv=none; d=google.com; s=arc-20160816; b=WKM2VgGijdHQeM2FwB0IO+4Vjty2SpsPY5dkw4FMJx+MEqlFXEmXPAAv5627ufocWZ W6wlmThSMGs+24qlZLTjbAUhpxOwOeFTtcaNsOMWQc9sIkAVn5Id9637Y1hL1Y2mLTwf ulktIYkjGsJwhYPjZukHQSnGibjCXGLlDQuQfDgjvCY3iWzC5GniHf9e/MFyg2bMLYZa fAX+IBxRVlbjUsBqE+u43JGtrv1Gl79hr0UZso/5lyrOvnbmVsAmg1RkcQ4HJ9WENM8M lEba8wNlVg5F2zmd8pDQQiYCmNbILkg7dbkdWKq9Wlbjxm7i80Fw/81EcQ8AySArxcJg yolA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=kb5jp+HwFdWZaxh/wzSn4PSPYXmGdpTEy3PT45zKCaI=; b=gvXnkWLSBwqW7td//3kaafwn9sRVrZwygRqRLjXPIJhSO1L9dLGI5Z4uyRf5Dcop0c hBMvkxc9WEjI5+7gqSMs4OcMxmhsvoG5EpIJBtFIQ8lWoF8cYKvrrUz3kmosecaAQIln 1F9f/Gu8DZEVEf+UHJNa02gCPTC8Wg7L8qEvpTEQXfiAn/6zVbTI/8bNowy2p3gn2o36 E1q+y7IO5FrHN33DY7UEcx3WF0/hE4UTw1JL9YIIft/IdihO76778hx4ZTt9jQVPlBFL Bt/dvp4c+S6JxQHU/Scsnn+MOZlPtzVJdamHRXe9ZuhIpNExJtlRPnUcKXlyHMV8BhM0 Ro/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si4993211plg.28.2022.01.31.01.36.01; Mon, 31 Jan 2022 01:36:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244378AbiA1Lmx (ORCPT + 99 others); Fri, 28 Jan 2022 06:42:53 -0500 Received: from mail.loongson.cn ([114.242.206.163]:40644 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238757AbiA1Lml (ORCPT ); Fri, 28 Jan 2022 06:42:41 -0500 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxb+Kh1vNhREgFAA--.17556S5; Fri, 28 Jan 2022 19:42:27 +0800 (CST) From: Tiezhu Yang To: Baoquan He , Jonathan Corbet , Andrew Morton , Peter Zijlstra , Marco Elver Cc: kexec@lists.infradead.org, linux-doc@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] kcsan: unset panic_on_warn before calling panic() Date: Fri, 28 Jan 2022 19:42:23 +0800 Message-Id: <1643370145-26831-4-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1643370145-26831-1-git-send-email-yangtiezhu@loongson.cn> References: <1643370145-26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Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr 0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU5Zj jPUUUUU== X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As done in the full WARN() handler, panic_on_warn needs to be cleared before calling panic() to avoid recursive panics. Signed-off-by: Tiezhu Yang --- kernel/kcsan/report.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/kcsan/report.c b/kernel/kcsan/report.c index 6779440..752ab33 100644 --- a/kernel/kcsan/report.c +++ b/kernel/kcsan/report.c @@ -492,8 +492,16 @@ static void print_report(enum kcsan_value_change value_change, dump_stack_print_info(KERN_DEFAULT); pr_err("==================================================================\n"); - if (panic_on_warn) + if (panic_on_warn) { + /* + * This thread may hit another WARN() in the panic path. + * Resetting this prevents additional WARN() from panicking the + * system on this thread. Other threads are blocked by the + * panic_mutex in panic(). + */ + panic_on_warn = 0; panic("panic_on_warn set ...\n"); + } } static void release_report(unsigned long *flags, struct other_info *other_info) -- 2.1.0