From: Jiri Slaby <jirislaby@kernel.org>
To: Tomas Mudrunka <tomas.mudrunka@gmail.com>
Cc: corbet@lwn.net, gregkh@linuxfoundation.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH v3] /proc/sysrq-trigger: accept multiple keys at once
Date: Tue, 14 Nov 2023 10:50:39 +0100 [thread overview]
Message-ID: <a7308079-2605-4708-9886-2f517481d728@kernel.org> (raw)
In-Reply-To: <20231114094903.73789-1-tomas.mudrunka@gmail.com>
On 14. 11. 23, 10:49, Tomas Mudrunka wrote:
> Just for convenience.
> This way we can do:
> `echo _reisub > /proc/sysrq-trigger`
> Instead of:
> `for i in r e i s u b; do echo "$i" > /proc/sysrq-trigger; done;`
>
> This can be very useful when trying to execute sysrq combo remotely
> or from userspace. When sending keys in multiple separate writes,
> userspace can be killed before whole combo is completed.
> Therefore putting all keys in single write is more robust approach.
>
> Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
> ---
What has changed in v2, v3?
> Documentation/admin-guide/sysrq.rst | 4 ++++
> drivers/tty/sysrq.c | 19 +++++++++++++++----
> 2 files changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/admin-guide/sysrq.rst b/Documentation/admin-guide/sysrq.rst
> index 51906e473..9d46a33e5 100644
> --- a/Documentation/admin-guide/sysrq.rst
> +++ b/Documentation/admin-guide/sysrq.rst
> @@ -79,6 +79,10 @@ On all
>
> echo t > /proc/sysrq-trigger
>
> + Alternatively write key combo prepended by underscore. e.g.::
> +
> + echo _reisub > /proc/sysrq-trigger
> +
> The :kbd:`<command key>` is case sensitive.
>
> What are the 'command' keys?
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 6b4a28bcf..367028b1e 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -1150,16 +1150,27 @@ EXPORT_SYMBOL(unregister_sysrq_key);
> #ifdef CONFIG_PROC_FS
> /*
> * writing 'C' to /proc/sysrq-trigger is like sysrq-C
> + * If first character in write is underscore, all characters are interpreted.
> */
> static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
> size_t count, loff_t *ppos)
> {
> - if (count) {
> - char c;
> + char bulk = false;
> + size_t i;
>
> - if (get_user(c, buf))
> + for (i = 0; i < count; i++) {
> + bool c;
bool c?
--
js
suse labs
next prev parent reply other threads:[~2023-11-14 9:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2023111330-headstone-pyromania-c57e@gregkh>
2023-11-14 9:35 ` [PATCH v2] /proc/sysrq-trigger: accept multiple keys at once Tomas Mudrunka
2023-11-14 9:44 ` Jiri Slaby
2023-11-14 9:49 ` [PATCH v3] " Tomas Mudrunka
2023-11-14 9:50 ` Jiri Slaby [this message]
2023-11-14 9:55 ` [PATCH v4] " Tomas Mudrunka
2023-11-14 12:14 ` Greg KH
2023-11-14 12:41 ` [PATCH v5] " Tomas Mudrunka
2023-11-14 15:12 ` [PATCH v6] " Tomas Mudrunka
2023-11-14 18:04 ` Jiri Slaby
2023-11-14 22:00 ` Randy Dunlap
2023-11-15 10:10 ` Jiri Slaby
2023-11-15 10:27 ` [PATCH v7] " Tomas Mudrunka
2023-11-15 10:29 ` [PATCH v8] " Tomas Mudrunka
2023-11-15 10:34 ` [PATCH v9] " Tomas Mudrunka
2023-11-20 7:45 ` Jiri Slaby
2023-11-20 11:14 ` [PATCH v10] " Tomas Mudrunka
2023-11-20 11:32 ` Jiri Slaby
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=a7308079-2605-4708-9886-2f517481d728@kernel.org \
--to=jirislaby@kernel.org \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tomas.mudrunka@gmail.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).