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: <CAN+4W8hAqVxbr040b_+Q-zF0Dv0utoj_UfwH+4LVk=Vx2TTFZA@mail.gmail.com>
Date: Mon, 22 Dec 2025 17:23:59 +0100
From: Lorenz Bauer <lmb@...valent.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Amit Shah <amit@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org, 
	stable@...r.kernel.org
Subject: Re: [PATCH v2] virtio: console: fix lost wakeup when device is
 written and polled

On Mon, Dec 22, 2025 at 5:13 PM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Mon, Dec 22, 2025, at 17:04, Lorenz Bauer wrote:
> > --- a/drivers/char/virtio_console.c
> > +++ b/drivers/char/virtio_console.c
> > @@ -971,10 +971,17 @@ static __poll_t port_fops_poll(struct file *filp,
> > poll_table *wait)
> >               return EPOLLHUP;
> >       }
> >       ret = 0;
> > -     if (!will_read_block(port))
> > +
> > +     spin_lock(&port->inbuf_lock);
> > +     if (port->inbuf)
>
> As far as I can tell, you got the interrupt flag handling wrong
> in both places: port_fops_poll() is called with interrupts
> enabled, so you have to use spin_lock_irq() to block the
> interrupt from hanging.

Ack.

> > @@ -1705,6 +1713,10 @@ static void out_intr(struct virtqueue *vq)
> >               return;
> >       }
> >
> > +     spin_lock_irqsave(&port->outvq_lock, flags);
> > +     reclaim_consumed_buffers(port);
> > +     spin_unlock_irqrestore(&port->outvq_lock, flags);
> > +
> >       wake_up_interruptible(&port->waitqueue);
>
> The callback seems to always be called with interrupts
> disabled(), so here it's safe to use spin_lock() instead
> of spin_lock_irqsave().

This is pretty much just copied from in_intr which also uses _irqsave.
I think it makes sense to stick to that for consistency's sake. What
do you think?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ