mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	 Nathan Chancellor <nathan@kernel.org>,
	linux-serial@vger.kernel.org, llvm@lists.linux.dev,
	 linux-kernel@vger.kernel.org, Ian Rogers <irogers@google.com>
Subject: [PATCH] tty: sysrq: Fix missing SYSRQ_ENABLE_DUMP mask on 'q' and 'd' keys
Date: Thu,  3 Dec 2026 09:17:29 -0800	[thread overview]
Message-ID: <20261203171729.442393-1-irogers@google.com> (raw)

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


                 reply	other threads:[~2026-12-03 17:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261203171729.442393-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=tglx@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

all inboxes | Powered by JetHome®