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: <4E900E9E.2070604@gmail.com>
Date:	Sat, 08 Oct 2011 10:49:34 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	Doug Anderson <dianders@...omium.org>
CC:	Greg Kroah-Hartman <gregkh@...e.de>,
	Alan Cox <alan@...ux.intel.com>, linux-serial@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] TTY: serial_core: Fix crash if agetty() run on non-console
 serial port

On 10/07/2011 11:59 PM, Doug Anderson wrote:
> The symptoms of the bug showed up if you were running agetty on ttyS0
> but not using ttyS0 as the console= port on the kernel command
> line.  In this case, if you suspended the system you'd get a crash
> on resume.
>
> The specific order of operations that were running:
> * uart_suspend_port() would be called to put the uart in suspend mode
> * a tty hangup would be processed
> * the hangup would call uart_shutdown()
> * ... suspend / resume happens ...
> * uart_resume_port() would be called and run the code in the
>   (port->flags & ASYNC_SUSPENDED) block, which would startup the port
>   (and enable tx again).
> * Since the UART would be available for tx, we'd immediately get
>   an interrupt, eventually calling transmit_chars()
> * The transmit_chars() function would crash.  The first crash would
>   be a dereference of a NULL tty member, but since the port has been
>   shutdown that was just a symptom.

I cannot reproduce this. What uart driver is this with? And where does
it call uart_suspend_port from? Basically, it would mean that it calls
uart_suspend_port while userspace is still running? Or who HUPs the port
(the second point in your list)?

> Signed-off-by: Doug Anderson <dianders@...omium.org>
> ---
>  drivers/tty/serial/serial_core.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index a3efbea..668e56a 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -255,6 +255,14 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
>  	}
>  
>  	/*
> +	 * It's possible for shutdown to be called after suspend.  Specifically
> +	 * if agetty() is listening to the serial port we get a HUP after the
> +	 * suspend happend (and HUP calls shutdown).  Clear suspended bit so
> +	 * we don't try to resume a port that has been shutdown.
> +	 */
> +	clear_bit(ASYNCB_SUSPENDED, &port->flags);
> +
> +	/*
>  	 * kill off our tasklet
>  	 */
>  	tasklet_kill(&state->tlet);

thanks,
-- 
js
--
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