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: <20250307112619.GA5963@redhat.com>
Date: Fri, 7 Mar 2025 12:26:20 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Hillf Danton <hdanton@...a.com>
Cc: K Prateek Nayak <kprateek.nayak@....com>,
	Mateusz Guzik <mjguzik@...il.com>,
	"Sapkal, Swapnil" <swapnil.sapkal@....com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still
 full

On 03/07, Hillf Danton wrote:
>
> On Thu, 6 Mar 2025 10:30:21 +0100 Oleg Nesterov <oleg@...hat.com>
> > > >
> > > > Yes, but in this case pipe_full() == true is correct, this writer can
> > > > safely sleep.
> > > >
> > > No, because no reader is woken up before sleep to make pipe not full.
> >
> > Why the reader should be woken before this writer sleeps? Why the reader
> > should be woken at all in this case (when pipe is full again) ?
> >
> "to make pipe not full" failed to prevent you asking questions like this one.

Hmm. I don't understand your "prevent you asking questions" reply.

If the pipe was full we do not need to wake the reader(s), the reader
can only sleep if pipe_empty() == true.

> > We certainly can't understand each other.

Yes.

> step-00
> 	pipe->head = 36
> 	pipe->tail = 36
> 	after 3d252160b818
>
> step-01
> 	task-118762 writer
> 	pipe->head++;
> 	wakes up task-118740 and task-118768
>
> step-02
> 	task-118768 writer
> 	makes pipe full;
> 	sleeps without waking up any reader as
> 	pipe was not empty after step-01
>
> step-03
> 	task-118766 new reader
> 	makes pipe empty
> 	sleeps

but since the pipe was full, this reader should wake up the
writer task-118768 once it updates the tail the 1st time during
the read.

> step-04
> 	task-118740 reader
> 	sleeps as pipe is empty

this is fine.

> [ Tasks 118740 and 118768 can then indefinitely wait on each other. ]

118768 should be woken at step 3 ?

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ