Patch "panic: unset panic_on_warn inside panic()" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    panic: unset panic_on_warn inside panic()

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     panic-unset-panic_on_warn-inside-panic.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From stable-owner@xxxxxxxxxxxxxxx Fri Feb  3 01:35:38 2023
From: Eric Biggers <ebiggers@xxxxxxxxxx>
Date: Thu,  2 Feb 2023 16:33:41 -0800
Subject: panic: unset panic_on_warn inside panic()
To: stable@xxxxxxxxxxxxxxx
Cc: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, SeongJae Park <sj@xxxxxxxxxx>, Seth Jenkins <sethjenkins@xxxxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, "Eric W . Biederman" <ebiederm@xxxxxxxxxxxx>, linux-hardening@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx>, Baoquan He <bhe@xxxxxxxxxx>, Jonathan Corbet <corbet@xxxxxxx>, Xuefeng Li <lixuefeng@xxxxxxxxxxx>, Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>, Marco Elver <elver@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Message-ID: <20230203003354.85691-3-ebiggers@xxxxxxxxxx>

From: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>

commit 1a2383e8b84c0451fd9b1eec3b9aab16f30b597c upstream.

In the current code, the following three places need to unset
panic_on_warn before calling panic() to avoid recursive panics:

kernel/kcsan/report.c: print_report()
kernel/sched/core.c: __schedule_bug()
mm/kfence/report.c: kfence_report_error()

In order to avoid copy-pasting "panic_on_warn = 0" all over the places,
it is better to move it inside panic() and then remove it from the other
places.

Link: https://lkml.kernel.org/r/1644324666-15947-4-git-send-email-yangtiezhu@xxxxxxxxxxx
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
Reviewed-by: Marco Elver <elver@xxxxxxxxxx>
Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx>
Cc: Baoquan He <bhe@xxxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Xuefeng Li <lixuefeng@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 kernel/panic.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -139,6 +139,16 @@ void panic(const char *fmt, ...)
 	int old_cpu, this_cpu;
 	bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers;
 
+	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;
+	}
+
 	/*
 	 * Disable local interrupts. This will prevent panic_smp_self_stop
 	 * from deadlocking the first cpu that invokes the panic, since
@@ -536,16 +546,8 @@ void __warn(const char *file, int line,
 	if (args)
 		vprintk(args->fmt, args->args);
 
-	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;
+	if (panic_on_warn)
 		panic("panic_on_warn set ...\n");
-	}
 
 	print_modules();
 


Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are

queue-4.14/panic-unset-panic_on_warn-inside-panic.patch
queue-4.14/objtool-add-a-missing-comma-to-avoid-string-concatenation.patch
queue-4.14/hexagon-fix-function-name-in-die.patch
queue-4.14/exit-add-and-use-make_task_dead.patch
queue-4.14/h8300-fix-build-errors-from-do_exit-to-make_task_dead-transition.patch
queue-4.14/panic-consolidate-open-coded-panic_on_warn-checks.patch
queue-4.14/exit-put-an-upper-limit-on-how-often-we-can-oops.patch
queue-4.14/panic-introduce-warn_limit.patch
queue-4.14/exit-allow-oops_limit-to-be-disabled.patch
queue-4.14/ia64-make-ia64_mca_recovery-bool-instead-of-tristate.patch
queue-4.14/exit-use-read_once-for-all-oops-warn-limit-reads.patch
queue-4.14/exit-expose-oops_count-to-sysfs.patch
queue-4.14/panic-expose-warn_count-to-sysfs.patch
queue-4.14/docs-fix-path-paste-o-for-sys-kernel-warn_count.patch
queue-4.14/sysctl-add-a-new-register_sysctl_init-interface.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux