Re: [PATCH v4 1/2] tty: sysrq: don't expose a partially written reset_seq

From: Zhan Xusheng

Date: Fri Oct 30 2026 - 03:58:41 EST


Hi Greg,

On Fri, Oct 30, 2026 at 08:02:30AM +0100, Greg KH wrote:
> I still don't understand what the root problem is here, sorry.

Each keyboard keeps its own copy of reset_seq. It rebuilds the copy on
the first key press after the parameter changes, and it rebuilds it
wrong in two ways.

1) It adds the new keys to the old copy instead of replacing it (2/2):

echo 56,29,111 > /sys/module/sysrq/parameters/reset_seq # Alt+Ctrl+Del
(press any key)
echo 59,60 > /sys/module/sysrq/parameters/reset_seq # F1+F2

Now F1+F2 does nothing. Only holding all five keys resets. So setting
reset_seq once works, but changing it later does not.

2) It can rebuild the copy while the write is half done (1/2). The
write stores the keys one at a time, and the keyboard may read the list
in between:

echo 59,60 > reset_seq
store 59
<- F1 pressed: keyboard reads "59" as the sequence
store 60

On a keyboard that has not used a reset sequence before, or on any
keyboard once 2/2 is applied, that F1 press completes the one-key
sequence and reboots the machine. The window is microseconds; I only
hit it with an added delay.

If you want this fixed, I'll send a v5 with a much smaller 1/2, plain
changelogs, and the Assisted-by: tag I should have added from the
start. Otherwise please drop it.

Thanks,
Zhan Xusheng