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: <CAEEQ3wkqY5K42n8H4xOia-Dv2mPUUK3wHT7je1YLM1jMys2BMQ@mail.gmail.com>
Date: Mon, 23 Jun 2025 14:44:58 +0800
From: yunhui cui <cuiyunhui@...edance.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: arnd@...db.de, andriy.shevchenko@...ux.intel.com, 
	benjamin.larsson@...exis.eu, gregkh@...uxfoundation.org, 
	heikki.krogerus@...ux.intel.com, ilpo.jarvinen@...ux.intel.com, 
	jirislaby@...nel.org, jkeeping@...usicbrands.com, 
	linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org, 
	markus.mayer@...aro.org, matt.porter@...aro.org, namcao@...utronix.de, 
	paulmck@...nel.org, pmladek@...e.com, schnelle@...ux.ibm.com, 
	sunilvl@...tanamicro.com, tim.kryger@...aro.org
Subject: Re: [External] Re: [PATCH v9 4/4] serial: 8250_dw: assert port->lock
 is held in dw8250_force_idle()

Hi John,

On Fri, Jun 20, 2025 at 8:14 PM John Ogness <john.ogness@...utronix.de> wrote:
>
> On 2025-06-10, Yunhui Cui <cuiyunhui@...edance.com> wrote:
> > Reading UART_RX and checking whether UART_LSR_DR is set should be
> > atomic. Ensure the caller of dw8250_force_idle() holds port->lock.
> >
> > Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
> > ---
> >  drivers/tty/serial/8250/8250_dw.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> > index 082b7fcf251db..686f9117a3339 100644
> > --- a/drivers/tty/serial/8250/8250_dw.c
> > +++ b/drivers/tty/serial/8250/8250_dw.c
> > @@ -13,6 +13,7 @@
> >  #include <linux/delay.h>
> >  #include <linux/device.h>
> >  #include <linux/io.h>
> > +#include <linux/lockdep.h>
> >  #include <linux/mod_devicetable.h>
> >  #include <linux/module.h>
> >  #include <linux/notifier.h>
> > @@ -117,6 +118,9 @@ static void dw8250_force_idle(struct uart_port *p)
> >       struct uart_8250_port *up = up_to_u8250p(p);
> >       unsigned int lsr;
> >
> > +     /* Reading UART_LSR and UART_RX should be atomic. */
> > +     lockdep_assert_held_once(&p->lock);
> > +
>
> It may be possible that during panic the port lock might not be held for
> console printing:
>
> serial8250_console_write()
>   oops_in_progress and failed trylock
>   serial8250_console_restore()
>     serial_port_out(..., UART_LCR, ...)
>       dw8250_serial_out*()
>         dw8250_check_lcr()
>           dw8250_force_idle()
>
> A similar incident was discussed before [0]. In that case the result was
> that the lockdep assertion was removed.
>
> John Ogness
>
> [0] https://lore.kernel.org/r/20230811064340.13400-1-jirislaby@kernel.org


If so, we can drop this patch.

Thanks,
Yunhui

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ