public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:USB SERIAL SUBSYSTEM" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] USB: serial: Change usb_debug to not echo by default
Date: Wed, 31 Jul 2024 15:21:44 +0200	[thread overview]
Message-ID: <Zqo6aBRw15Rf_3Gh@hovoldconsulting.com> (raw)
In-Reply-To: <20240715104456.1814444-1-marmarek@invisiblethingslab.com>

On Mon, Jul 15, 2024 at 12:44:53PM +0200, Marek Marczykowski-Górecki wrote:
> This driver is intended as a "client" end of the console connection.
> When connected to a host it's supposed to receive debug logs, and
> possibly allow to interact with whatever debug console is available
> there. Feeding messages back, depending on a configuration may cause log
> messages be executed as shell commands (which can be really bad if one
> is unlucky, imagine a log message like "prevented running `rm -rf
> /home`").

This should not be an issue as canonical input is also enabled by
default (and as long as no one outputs random commands like that on a
single line).

> In case of Xen, it exposes sysrq-like debug interface, and
> feeding it its own logs will pretty quickly hit 'R' for "instant
> reboot".

But this sounds annoying enough.

> Contrary to a classic serial console, the USB one cannot be configured
> ahead of time, as the device shows up only when target OS is up. And at
> the time device is opened to execute relevant ioctl, it's already too
> late, especially when logs start flowing shortly after device is
> initialized.
> Avoid the issue by changing default to no echo for this type of devices.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
>  drivers/usb/serial/usb_debug.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
> index 6934970f180d..91150c050637 100644
> --- a/drivers/usb/serial/usb_debug.c
> +++ b/drivers/usb/serial/usb_debug.c
> @@ -76,6 +76,11 @@ static void usb_debug_process_read_urb(struct urb *urb)
>  	usb_serial_generic_process_read_urb(urb);
>  }
>  
> +static void usb_debug_init_termios(struct tty_struct *tty)
> +{
> +	tty->termios.c_lflag &= ~ECHO;

I disabled echoing of newlines here as well when applying. Thanks.

Johan

      reply	other threads:[~2024-07-31 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 10:44 [PATCH] USB: serial: Change usb_debug to not echo by default Marek Marczykowski-Górecki
2024-07-31 13:21 ` Johan Hovold [this message]

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=Zqo6aBRw15Rf_3Gh@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marmarek@invisiblethingslab.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