All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Priolkar <rahul.priolkar@asu.edu>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org
Subject: [BUG] tty: sysrq: duplicate input handler registration on v7.4-rc5
Date: Wed, 02 Dec 2026 00:18:32 -0800 (PST)	[thread overview]
Message-ID: <6b0fd458.e5646aef.135df4.76b7@mx.google.com> (raw)

Hello,

On Linux v7.4-rc5 (fe6ff8d5d675), we observed duplicate entries for
the SysRq input handler on a defconfig-based x86_64 guest. In each
trial, we updated kernel.sysrq and checked /proc/bus/input/handlers
for exactly one SysRq entry. With concurrent updates, the handler
appeared 60 times in one listing after 98 trials. Updating kernel.sysrq
requires root in the initial user namespace.

Our reading of drivers/tty/sysrq.c is that sysrq_toggle_support() can
register the static handler twice because the enable-state check and
registration are not serialized. Does that match your understanding of
the failure?

A debug build with DEBUG_LIST and BUG_ON_DATA_CORRUPTION stopped in
the first run. The relevant frames were:

  kernel BUG at lib/list_debug.c:37!
  RIP: 0010:__list_add_valid_or_report
   input_register_handler
   sysrq_register_handler
   sysrq_sysctl_handler

On the unmodified kernel, we ran the updates one at a time as a
control. All 3,000 trials showed exactly one handler entry. We then
tested an rc5 build that included a mutex around sysrq_toggle_support()
along with our other candidate fixes. Across 6,000 concurrent-update
trials, we saw no duplicate entries or kernel warnings. I can share
the candidate patch if useful.

Thanks,
Rahul Priolkar

             reply	other threads:[~2026-12-02  8:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  8:18 Rahul Priolkar [this message]
2026-12-02  9:00 ` [BUG] tty: sysrq: duplicate input handler registration on v7.4-rc5 Greg Kroah-Hartman

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=6b0fd458.e5646aef.135df4.76b7@mx.google.com \
    --to=rahul.priolkar@asu.edu \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.