[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tv23tmy1.fsf@mpe.ellerman.id.au>
Date: Wed, 01 Apr 2020 23:22:46 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: Dmitry Safonov <dima@...sta.com>, linux-kernel@...r.kernel.org
Cc: Dmitry Safonov <0x7f454c46@...il.com>,
Dmitry Safonov <dima@...sta.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Iurii Zaikin <yzaikin@...gle.com>,
Jiri Slaby <jslaby@...e.com>, Joe Perches <joe@...ches.com>,
Randy Dunlap <rdunlap@...radead.org>,
Vasiliy Khoruzhick <vasilykh@...sta.com>,
linux-serial@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCHv3 1/2] sysctl/sysrq: Remove __sysrq_enabled copy
Dmitry Safonov <dima@...sta.com> writes:
> Many embedded boards have a disconnected TTL level serial which can
> generate some garbage that can lead to spurious false sysrq detects.
>
> Currently, sysrq can be either completely disabled for serial console
> or always disabled (with CONFIG_MAGIC_SYSRQ_SERIAL), since
> commit 732dbf3a6104 ("serial: do not accept sysrq characters via serial port")
>
> At Arista, we have such boards that can generate BREAK and random
> garbage. While disabling sysrq for serial console would solve
> the problem with spurious false sysrq triggers, it's also desirable
> to have a way to enable sysrq back.
>
> Having the way to enable sysrq was beneficial to debug lockups with
> a manual investigation in field and on the other side preventing false
> sysrq detections.
>
> As a preparation to add sysrq_toggle_support() call into uart,
> remove a private copy of sysrq_enabled from sysctl - it should reflect
> the actual status of sysrq.
>
> Furthermore, the private copy isn't correct already in case
> sysrq_always_enabled is true. So, remove __sysrq_enabled and use a
> getter-helper sysrq_mask() to check sysrq_key_op enabled status.
>
> Cc: Iurii Zaikin <yzaikin@...gle.com>
> Cc: Jiri Slaby <jslaby@...e.com>
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: linux-fsdevel@...r.kernel.org
> Signed-off-by: Dmitry Safonov <dima@...sta.com>
> ---
> drivers/tty/sysrq.c | 12 ++++++++++++
> include/linux/sysrq.h | 7 +++++++
> kernel/sysctl.c | 41 ++++++++++++++++++++++-------------------
> 3 files changed, 41 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index f724962a5906..5e0d0813da55 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -63,6 +63,18 @@ static bool sysrq_on(void)
> return sysrq_enabled || sysrq_always_enabled;
> }
>
> +/**
> + * sysrq_mask - Getter for sysrq_enabled mask.
> + *
> + * Return: 1 if sysrq is always enabled, enabled sysrq_key_op mask otherwise.
> + */
> +int sysrq_mask(void)
> +{
> + if (sysrq_always_enabled)
> + return 1;
> + return sysrq_enabled;
> +}
This seems to have broken several configs, when serial_core is modular, with:
ERROR: modpost: "sysrq_mask" [drivers/tty/serial/serial_core.ko] undefined!
See:
http://kisskb.ellerman.id.au/kisskb/buildresult/14169386/
It's also being reported by the kernelci bot:
https://lore.kernel.org/linux-next/5e677bd0.1c69fb81.c43fe.7f7d@mx.google.com/
cheers
Powered by blists - more mailing lists