[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1643370145-26831-4-git-send-email-yangtiezhu@loongson.cn>
Date: Fri, 28 Jan 2022 19:42:23 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Baoquan He <bhe@...hat.com>, Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Marco Elver <elver@...gle.com>
Cc: kexec@...ts.infradead.org, linux-doc@...r.kernel.org,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] kcsan: unset panic_on_warn before calling panic()
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 <yangtiezhu@...ngson.cn>
---
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
Powered by blists - more mailing lists