[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bacb56a3bcdd15921fa348c6ea1a18e0a9734b22.1764272407.git.chris@chrisdown.name>
Date: Fri, 28 Nov 2025 03:43:54 +0800
From: Chris Down <chris@...isdown.name>
To: Petr Mladek <pmladek@...e.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Tony Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: [PATCH v8 12/21] printk: Ensure sysrq output bypasses per-console
filtering
During sysrq handling, per-console loglevels are temporarily disabled
to ensure all requisite messages are printed to the console. This is
necessary because sysrq is often used in dire circumstances where
access to /sys/class/console may not be trivially possible, and all
diagnostic output needs to reach the operator regardless of per-console
filtering.
The implementation saves and restores the ignore_per_console_loglevel
flag around the sysrq handler, similar to how suppress_printk is
already handled.
Reviewed-by: Petr Mladek <pmladek@...e.com>
Signed-off-by: Chris Down <chris@...isdown.name>
---
drivers/tty/sysrq.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 97f8a9a52285..1d5ae9997e79 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -51,6 +51,7 @@
#include <linux/syscalls.h>
#include <linux/of.h>
#include <linux/rcupdate.h>
+#include <linux/printk.h>
#include <asm/ptrace.h>
#include <asm/irq_regs.h>
@@ -583,12 +584,16 @@ static void __sysrq_put_key_op(u8 key, const struct sysrq_key_op *op_p)
void __handle_sysrq(u8 key, bool check_mask)
{
const struct sysrq_key_op *op_p;
+ bool orig_ignore_per_console_loglevel;
int orig_suppress_printk;
int i;
orig_suppress_printk = suppress_printk;
suppress_printk = 0;
+ orig_ignore_per_console_loglevel = ignore_per_console_loglevel;
+ ignore_per_console_loglevel = true;
+
rcu_sysrq_start();
rcu_read_lock();
/*
@@ -634,6 +639,7 @@ void __handle_sysrq(u8 key, bool check_mask)
rcu_read_unlock();
rcu_sysrq_end();
+ ignore_per_console_loglevel = orig_ignore_per_console_loglevel;
suppress_printk = orig_suppress_printk;
}
--
2.51.2
Powered by blists - more mailing lists