mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: fujo <hooyan2024@gmail.com>
Cc: linux-fsdevel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] selftests/pidfd: wait for POLLHUP before reading exit info
Date: Wed, 21 Oct 2026 09:36:03 +0200	[thread overview]
Message-ID: <athrY3NE41WWDj8k@redhat.com> (raw)
In-Reply-To: <179252551833.59967.12617794775210688694@gmail.com>

On 10/20, fujo wrote:
>
> The CLONE_AUTOREAP tests poll for POLLIN and then immediately call
> PIDFD_GET_INFO with PIDFD_INFO_EXIT.  PIDFD_INFO_EXIT is only published
> from release_task() -> pidfs_exit(), which runs after the pidfd already
> reported POLLIN for the exited task.  A poller woken by
> do_notify_pidfd() can therefore read a mask without PIDFD_INFO_EXIT;
> under KASAN the autoreap_multithreaded case fails this way.
>
> POLLHUP is returned once the task linkage has been removed from
> struct pid, which happens after pidfs_exit() has published the exit
> information.  Wait for POLLHUP and check it in revents.
>
> The zero-timeout liveness check in autokill_pidfd_open_no_effect keeps
> POLLIN; it verifies that the child has not exited yet.
>
> With this change all tests pass ten consecutive runs on an unpatched
> kernel.
>
> Signed-off-by: fujo <hooyan2024@gmail.com>
> ---
>  .../selftests/pidfd/pidfd_autoreap_test.c     | 34 +++++++++----------
>  1 file changed, 17 insertions(+), 17 deletions(-)

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


  reply	other threads:[~2026-10-21  7:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  5:43 [RFC PATCH] pidfs: don't report autoreaped tasks readable before exit info exists fujo
2026-10-17 13:48 ` Oleg Nesterov
2026-10-17 19:23 ` [PATCH v2] selftests/pidfd: wait for POLLHUP before reading exit info fujo
2026-10-18 16:25   ` Oleg Nesterov
2026-10-18 16:48     ` [PATCH v3] " fujo
2026-10-20  9:52       ` Oleg Nesterov
2026-10-20 19:45         ` fujo
2026-10-20 19:45         ` [PATCH v4] " fujo
2026-10-21  7:36           ` Oleg Nesterov [this message]
2026-10-21 10:02           ` Christian Brauner
2026-10-18 16:48     ` [PATCH v2] " fujo
2026-10-18 19:27       ` Oleg Nesterov
2026-10-17 19:23 ` [RFC PATCH] pidfs: don't report autoreaped tasks readable before exit info exists fujo
2026-10-18 16:30   ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=athrY3NE41WWDj8k@redhat.com \
    --to=oleg@redhat.com \
    --cc=brauner@kernel.org \
    --cc=hooyan2024@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®