Re: [PATCH-next 3/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE

From: Greg Kroah-Hartman
Date: Wed Jan 15 2020 - 07:42:17 EST


On Tue, Jan 14, 2020 at 07:10:47PM +0000, Dmitry Safonov wrote:
> On 1/10/20 10:32 PM, Dmitry Safonov wrote:
> > On 1/10/20 4:46 PM, Greg Kroah-Hartman wrote:
> > [..]
> >>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> >>> index 6ac9dfed3423..f70eba032d0b 100644
> >>> --- a/drivers/tty/serial/serial_core.c
> >>> +++ b/drivers/tty/serial/serial_core.c
> >>> @@ -3081,6 +3081,38 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
> >>> }
> >>> EXPORT_SYMBOL_GPL(uart_insert_char);
> >>>
> >>> +const char sysrq_toggle_seq[] = CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE;
> >>> +
> >>> +static void uart_sysrq_on(struct work_struct *w)
> >>> +{
> >>> + sysrq_toggle_support(1);
> >>> + pr_info("SysRq is enabled by magic sequience on serial\n");
> >>
> >> Do we want to say what serial port it is enabled on?
> >
> > Makes sense, will add.
>
> Ah, I've managed to forget to mention that I didn't add the port name
> into the message in v2. I experimented a bit - it's getting a bit
> complicated how-to protect (char *name) for just this message.
> Like, SysRq can be theoretically enabled on two serials at the same
> moment - so some locking is needed to make the printed name sane.
>
> As sysrq_toggle_support() is a global-enable knob for sysrq (also can be
> switched in /proc/sys/kernel/sysrq) I'm not sure if it's worth to
> complicate code to print through which serial console SysRq has been
> enabled.
>
> I can still do it in v3 if you insist.

No worries, if it's too hard to get to, that's fine. If it was
available, it would have been nice to have.

thanks,

greg k-h