public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nir Lichtman <nir@lichtman.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] kernel: add boot param to disable stack dump on panic
Date: Tue, 6 Feb 2024 21:39:02 +0000	[thread overview]
Message-ID: <20240206213902.GA1490631@lichtman.org> (raw)

From: Nir Lichtman <nir@lichtman.org>
Date: Sat, 3 Feb 2024 10:19:30 +0200
Subject: [PATCH] kernel: add boot param to disable stack dump on panic

---
 Documentation/admin-guide/kernel-parameters.txt |  5 +++++
 kernel/panic.c                                  | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 31b3a2568..433e3e5d1 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1127,6 +1127,11 @@
 			MTRR settings.  This parameter disables that behavior,
 			possibly causing your machine to run very slowly.
 
+	disable_stack_dump_on_panic
+			This parameter disables call stack dumping when there
+			is a panic, which can help obscure less earlier messages
+			that lead to the panic.
+
 	disable_timer_pin_1 [X86]
 			Disable PIN 1 of APIC timer
 			Can be useful to work around chipset bugs.
diff --git a/kernel/panic.c b/kernel/panic.c
index 2807639aa..a1e1d064e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -266,6 +266,16 @@ static void panic_other_cpus_shutdown(bool crash_kexec)
 		crash_smp_send_stop();
 }
 
+static int disable_stack_dump_on_panic __initdata;
+
+static int __init disable_stack_dump_on_panic_setup(char *str)
+{
+	disable_stack_dump_on_panic = 1;
+	return 0;
+}
+
+early_param("disable_stack_dump_on_panic", disable_stack_dump_on_panic_setup);
+
 /**
  *	panic - halt the system
  *	@fmt: The text string to print
@@ -340,7 +350,7 @@ void panic(const char *fmt, ...)
 	/*
 	 * Avoid nested stack-dumping if a panic occurs during oops processing
 	 */
-	if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
+	if (!test_taint(TAINT_DIE) && oops_in_progress <= 1 && !disable_stack_dump_on_panic)
 		dump_stack();
 #endif
 
-- 
2.39.2


             reply	other threads:[~2024-02-06 21:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 21:39 Nir Lichtman [this message]
2024-02-07  2:10 ` [PATCH] kernel: add boot param to disable stack dump on panic Bagas Sanjaya
2024-02-08  8:14   ` Nir Lichtman
2024-02-09  9:22     ` Bagas Sanjaya
2024-02-09  9:50       ` Nir Lichtman
2024-02-09 23:13         ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240206213902.GA1490631@lichtman.org \
    --to=nir@lichtman.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox