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] [day] [month] [year] [list]
Message-ID: <4bb69834-405c-40da-ac3d-f5b29d2eecf0@p183>
Date:   Thu, 5 Oct 2023 21:44:44 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Jiri Slaby <jirislaby@...nel.org>, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: stack leak via uart_get_info() ?

On Thu, Oct 05, 2023 at 07:55:34PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Oct 05, 2023 at 07:34:21PM +0300, Alexey Dobriyan wrote:
> > If this check ever triggers
> > 
> > 	static int uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
> > 	{
> > 
> > 		uport = uart_port_check(state);
> > 	        if (!uport)
> > 	                goto out;
> > 
> > then all those sysfs users will print stack contents to userspace.
> > 
> > Can it trigger while sysfs read is executing?
> 
> I don't think it can ever fail, we don't even check the result in other
> places, so it should all be fine.
> 
> > Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> > ---
> > 
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -775,6 +775,8 @@ static int uart_get_info(struct tty_port *port, struct serial_struct *retinfo)
> >  	struct uart_port *uport;
> >  	int ret = -ENODEV;
> >  
> > +	*retinfo = (struct serial_struct){};
> 
> This is good (although I hate the implied memcpy), a real memset would
> be best to ensure that any holes are also filled.  Want to do that, or
> want me to?

I don't mind memset(), but "struct serial_struct" structure has kernel
pointers:

	unsigned char* iomem_base;

so it is not shipped to userspace, so padding isn't an issue.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ