From: Michael Ellerman <mpe@ellerman.id.au>
To: Dmitry Safonov <dima@arista.com>, linux-kernel@vger.kernel.org
Cc: Dmitry Safonov <0x7f454c46@gmail.com>,
Dmitry Safonov <dima@arista.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Iurii Zaikin <yzaikin@google.com>, Jiri Slaby <jslaby@suse.com>,
Joe Perches <joe@perches.com>,
Randy Dunlap <rdunlap@infradead.org>,
Vasiliy Khoruzhick <vasilykh@arista.com>,
linux-serial@vger.kernel.org,
Luis Chamberlain <mcgrof@kernel.org>,
Kees Cook <keescook@chromium.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCHv3 1/2] sysctl/sysrq: Remove __sysrq_enabled copy
Date: Wed, 01 Apr 2020 23:22:46 +1100 [thread overview]
Message-ID: <87tv23tmy1.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20200302175135.269397-2-dima@arista.com>
Dmitry Safonov <dima@arista.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@google.com>
> Cc: Jiri Slaby <jslaby@suse.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: linux-fsdevel@vger.kernel.org
> Signed-off-by: Dmitry Safonov <dima@arista.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
next prev parent reply other threads:[~2020-04-01 12:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 17:51 [PATCHv3 0/2] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-03-02 17:51 ` [PATCHv3 1/2] sysctl/sysrq: Remove __sysrq_enabled copy Dmitry Safonov
2020-04-01 12:22 ` Michael Ellerman [this message]
2020-04-01 14:41 ` Dmitry Safonov
2020-03-02 17:51 ` [PATCHv3 2/2] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-03-03 4:31 ` kbuild test robot
2020-03-03 18:06 ` Dmitry Safonov
2020-03-06 12:55 ` Greg Kroah-Hartman
2020-03-06 14:50 ` Dmitry Safonov
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=87tv23tmy1.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=0x7f454c46@gmail.com \
--cc=dima@arista.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=rdunlap@infradead.org \
--cc=vasilykh@arista.com \
--cc=yzaikin@google.com \
/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;
as well as URLs for NNTP newsgroup(s).