lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <200907051254.41964.rgetz@blackfin.uclinux.org>
Date:	Sun, 5 Jul 2009 12:54:41 -0400
From:	Robin Getz <rgetz@...ckfin.uclinux.org>
To:	"Alan Cox" <alan@...rguk.ukuu.org.uk>, greg@...ah.com
CC:	"Jason Wessel" <jason.wessel@...driver.com>,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 2/2] usb_serial: only allow sysrq on a console port

On Mon 1 Jun 2009 09:35, Alan Cox pondered:
> On Fri, 29 May 2009 13:34:17 -0500
> Jason Wessel <jason.wessel@...driver.com> wrote:
> 
> > The only time a sysrq should get processed is if the attached device
> > is a console.  This is intended to protect sysrq execution on a host
> > connected with a terminal program.
> 
> This doesn't seem to match any tree I can find ?

Alan:

If Jason's patch is necessary () - should this be fixed up for standard
UARTs too?

Make sure that only serial console (not _any_ serial port) responds to 
sysrq (or should something else be ensuring that this isn't set when 
the port !console? (I didn't see anything in serial_core.c?)

---

diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 23d2fb0..f8ab858 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -474,7 +474,7 @@ static inline int
 uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
 {
 #ifdef SUPPORT_SYSRQ
-       if (port->sysrq) {
+       if (port->sysrq && port->console) {
                if (ch && time_before(jiffies, port->sysrq)) {
                        handle_sysrq(ch, port->info->port.tty);
                        port->sysrq = 0;

----------

That brings up the next question...

The above patch would sync the (seemlying duplicated) code between
drivers/usb/serial/generic.c and include/linux/serial_core.h

Greg?

drivers/usb/serial/generic.c
int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
{
        if (port->sysrq && port->console) {
                if (ch && time_before(jiffies, port->sysrq)) {
                        handle_sysrq(ch, tty_port_tty_get(&port->port));
                        port->sysrq = 0;
                        return 1;
                }
                port->sysrq = 0;
        }
        return 0;
}

include/linux/serial_core.h
static inline int
uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
{
#ifdef SUPPORT_SYSRQ
        if (port->sysrq) {
                if (ch && time_before(jiffies, port->sysrq)) {
                        handle_sysrq(ch, port->info->port.tty);
                        port->sysrq = 0;
                        return 1;
                }
                port->sysrq = 0;
        }
#endif
        return 0;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ