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: <CAHk-=whydHy48QDorhGeRLdxdL_1iNt=TJkaJ4rO1xF0WS+iTg@mail.gmail.com>
Date: Tue, 4 Mar 2025 18:52:27 -1000
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: K Prateek Nayak <kprateek.nayak@....com>
Cc: Oleg Nesterov <oleg@...hat.com>, Mateusz Guzik <mjguzik@...il.com>, 
	"Sapkal, Swapnil" <swapnil.sapkal@....com>, Manfred Spraul <manfred@...orfullife.com>, 
	Christian Brauner <brauner@...nel.org>, David Howells <dhowells@...hat.com>, 
	WangYuli <wangyuli@...ontech.com>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org, 
	"Shenoy, Gautham Ranjal" <gautham.shenoy@....com>, Neeraj.Upadhyay@....com, Ananth.narayan@....com
Subject: Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full

On Tue, 4 Mar 2025 at 18:41, K Prateek Nayak <kprateek.nayak@....com> wrote:
>
> >          spin_lock_irq(&pipe->rd_wait.lock);
> >           ...
> >          pipe->tail = ++tail;
> >          ...
> >          spin_unlock_irq(&pipe->rd_wait.lock);
>
>  From my understanding, this is still done with "pipe->mutex" held. Both
> anon_pipe_read() and pipe_resize_ring() will lock "pipe->mutex" first
> and then take the "pipe->rd_wait.lock" when updating "pipe->tail".
> "pipe->head" is always updated with "pipe->mutex" held.

No, see the actual watch_queue code: post_one_notification() in
fs/watch_queue.c.

It's isn't the exact sequence I posted, it looks like

        smp_store_release(&pipe->head, head + 1); /* vs pipe_read() */

instead, and it's pipe->head there vs pipe->tail in pipe_read().

And I do think we end up having exclusion thanks to pipe_update_tail()
taking that spinlock if the pipe is actually a watchqueue thing, so it
might all be ok on alpha too.

So *maybe* we can just make it all be two 16-bit words in a 32-bit
thing, but somebody needs to walk through it all to make sure.

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ