[PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()

Oleg Nesterov posted 5 patches 11 months, 2 weeks ago
include/linux/poll.h | 26 ++++++++++++--------------
include/net/sock.h   | 17 +++++++----------
io_uring/io_uring.c  |  9 ++++-----
3 files changed, 23 insertions(+), 29 deletions(-)
[PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Posted by Oleg Nesterov 11 months, 2 weeks ago
Linus,

I misread fs/eventpoll.c, it has the same problem. And more __pollwait()-like
functions, for example p9_pollwait(). So 1/5 adds mb() into poll_wait(), not
into __pollwait().

WangYuli, after 1/5 we can reconsider your patch.

Oleg.
---

 include/linux/poll.h | 26 ++++++++++++--------------
 include/net/sock.h   | 17 +++++++----------
 io_uring/io_uring.c  |  9 ++++-----
 3 files changed, 23 insertions(+), 29 deletions(-)
Re: [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Posted by Christian Brauner 11 months, 1 week ago
On Tue, 07 Jan 2025 17:26:49 +0100, Oleg Nesterov wrote:
> Linus,
> 
> I misread fs/eventpoll.c, it has the same problem. And more __pollwait()-like
> functions, for example p9_pollwait(). So 1/5 adds mb() into poll_wait(), not
> into __pollwait().
> 
> WangYuli, after 1/5 we can reconsider your patch.
> 
> [...]

Applied to the vfs-6.14.poll branch of the vfs/vfs.git tree.
Patches in the vfs-6.14.poll branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.14.poll

[1/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
      https://git.kernel.org/vfs/vfs/c/cacd9ae4bf80
[2/5] poll_wait: kill the obsolete wait_address check
      https://git.kernel.org/vfs/vfs/c/10b02a2cfec2
[3/5] io_uring_poll: kill the no longer necessary barrier after poll_wait()
      https://git.kernel.org/vfs/vfs/c/4e15fa8305de
[4/5] sock_poll_wait: kill the no longer necessary barrier after poll_wait()
      https://git.kernel.org/vfs/vfs/c/b2849867b3a7
[5/5] poll: kill poll_does_not_wait()
      https://git.kernel.org/vfs/vfs/c/f005bf18a57a
Re: [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Posted by Linus Torvalds 11 months, 2 weeks ago
On Tue, 7 Jan 2025 at 08:27, Oleg Nesterov <oleg@redhat.com> wrote:
>
> I misread fs/eventpoll.c, it has the same problem. And more __pollwait()-like
> functions, for example p9_pollwait(). So 1/5 adds mb() into poll_wait(), not
> into __pollwait().

Ack on all five patches, looks sane to me.

Christian, I'm assuming this goes through your tree? If not, holler,
and I can take it directly.

            Linus
Re: [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Posted by Christian Brauner 11 months, 1 week ago
On Tue, Jan 07, 2025 at 09:38:36AM -0800, Linus Torvalds wrote:
> On Tue, 7 Jan 2025 at 08:27, Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > I misread fs/eventpoll.c, it has the same problem. And more __pollwait()-like
> > functions, for example p9_pollwait(). So 1/5 adds mb() into poll_wait(), not
> > into __pollwait().
> 
> Ack on all five patches, looks sane to me.
> 
> Christian, I'm assuming this goes through your tree? If not, holler,
> and I can take it directly.

Yes, on it. Sorry, this took a bit. I'm trying to work downwards through
all the mail.
Re: [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
Posted by Jens Axboe 11 months, 2 weeks ago
On 1/7/25 10:38 AM, Linus Torvalds wrote:
> On Tue, 7 Jan 2025 at 08:27, Oleg Nesterov <oleg@redhat.com> wrote:
>>
>> I misread fs/eventpoll.c, it has the same problem. And more __pollwait()-like
>> functions, for example p9_pollwait(). So 1/5 adds mb() into poll_wait(), not
>> into __pollwait().
> 
> Ack on all five patches, looks sane to me.
> 
> Christian, I'm assuming this goes through your tree? If not, holler,
> and I can take it directly.

Same, series looks good.

-- 
Jens Axboe