* [PATCH] tty: sysrq: Fix missing SYSRQ_ENABLE_DUMP mask on 'q' and 'd' keys
@ 2026-12-03 17:17 Ian Rogers
2026-12-03 18:13 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2026-12-03 17:17 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby
Cc: Thomas Gleixner, Ingo Molnar, Nathan Chancellor, linux-serial,
llvm, linux-kernel, Ian Rogers
Both sysrq_show_timers_op ('q', show-all-timers) and sysrq_showlocks_op
('d', show-all-locks) are diagnostic dump operations, just like 'l',
'p', 't', 'w', 'm', and 'z', which all set SYSRQ_ENABLE_DUMP (0x8).
Because .enable_mask was omitted in sysrq_show_timers_op and
sysrq_showlocks_op, it defaulted to 0. When /proc/sys/kernel/sysrq is
configured with a bitmask (> 1) such as 0x8 (SYSRQ_ENABLE_DUMP),
sysrq_on_mask(0) evaluates (sysrq_enabled & 0) == 0, preventing 'q' and
'd' from working via SysRq key combinations unless all SysRq functions
are unconditionally enabled (sysrq == 1).
Found with Clang's require_explicit_initialization attribute on
struct sysrq_key_op.
Fixes: 88ad0bf68905 ("[PATCH] Add SysRq-Q to print timer_list debug info")
Fixes: de5097c2e73f ("[PATCH] mutex subsystem, more debugging code")
Signed-off-by: Ian Rogers <irogers@google.com>
---
Note: Found using Clang's require_explicit_initialization attribute;
an AI coding assistant helped audit call sites, verify Fixes commits,
and draft the changelog.
drivers/tty/sysrq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index f4571d05b496..068fea418af5 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -195,6 +195,7 @@ static const struct sysrq_key_op sysrq_show_timers_op = {
.handler = sysrq_handle_show_timers,
.help_msg = "show-all-timers(q)",
.action_msg = "Show clockevent devices & pending hrtimers (no others)",
+ .enable_mask = SYSRQ_ENABLE_DUMP,
};
static void sysrq_handle_mountro(u8 key)
@@ -218,6 +219,7 @@ static const struct sysrq_key_op sysrq_showlocks_op = {
.handler = sysrq_handle_showlocks,
.help_msg = "show-all-locks(d)",
.action_msg = "Show Locks Held",
+ .enable_mask = SYSRQ_ENABLE_DUMP,
};
#else
#define sysrq_showlocks_op (*(const struct sysrq_key_op *)NULL)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tty: sysrq: Fix missing SYSRQ_ENABLE_DUMP mask on 'q' and 'd' keys
2026-12-03 17:17 [PATCH] tty: sysrq: Fix missing SYSRQ_ENABLE_DUMP mask on 'q' and 'd' keys Ian Rogers
@ 2026-12-03 18:13 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-03 18:13 UTC (permalink / raw)
To: Ian Rogers; +Cc: linux-serial
> Both sysrq_show_timers_op ('q', show-all-timers) and sysrq_showlocks_op
> ('d', show-all-locks) are diagnostic dump operations, just like 'l',
> 'p', 't', 'w', 'm', and 'z', which all set SYSRQ_ENABLE_DUMP (0x8).
>
> Because .enable_mask was omitted in sysrq_show_timers_op and
> sysrq_showlocks_op, it defaulted to 0. When /proc/sys/kernel/sysrq is
> configured with a bitmask (> 1) such as 0x8 (SYSRQ_ENABLE_DUMP),
> sysrq_on_mask(0) evaluates (sysrq_enabled & 0) == 0, preventing 'q' and
> 'd' from working via SysRq key combinations unless all SysRq functions
> are unconditionally enabled (sysrq == 1).
>
> Found with Clang's require_explicit_initialization attribute on
> struct sysrq_key_op.
>
> Fixes: 88ad0bf68905 ("[PATCH] Add SysRq-Q to print timer_list debug info")
> Fixes: de5097c2e73f ("[PATCH] mutex subsystem, more debugging code")
> Signed-off-by: Ian Rogers <irogers@google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203171729.442393-1-irogers@google.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 18:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 17:17 [PATCH] tty: sysrq: Fix missing SYSRQ_ENABLE_DUMP mask on 'q' and 'd' keys Ian Rogers
2026-12-03 18:13 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox