From: Oleg Nesterov <oleg@redhat.com>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org,
Andy Lutomirski <luto@amacapital.net>,
Steven Rostedt <rostedt@goodmis.org>,
Daniel Colascione <dancol@google.com>,
Christian Brauner <christian@brauner.io>,
Jann Horn <jannh@google.com>, Tim Murray <timmurray@google.com>,
Jonathan Kowalski <bl0pbl33p@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
David Howells <dhowells@redhat.com>,
kernel-team@android.com,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>,
linux-kselftest@vger.kernel.org, Michal Hocko <mhocko@suse.com>,
Nadav Amit <namit@vmware.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Serge Hallyn <serge@hallyn.com>, Shuah Khan <shuah@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Tycho Andersen <tycho@tycho.ws>
Subject: Re: [PATCH v2 1/2] Add polling support to pidfd
Date: Wed, 1 May 2019 17:13:12 +0200 [thread overview]
Message-ID: <20190501151312.GA30235@redhat.com> (raw)
In-Reply-To: <20190430162154.61314-1-joel@joelfernandes.org>
On 04/30, Joel Fernandes (Google) wrote:
>
> +static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
> +{
> + struct task_struct *task;
> + struct pid *pid = file->private_data;
> + int poll_flags = 0;
> +
> + poll_wait(file, &pid->wait_pidfd, pts);
> +
> + rcu_read_lock();
> + task = pid_task(pid, PIDTYPE_PID);
> + WARN_ON_ONCE(task && !thread_group_leader(task));
^^^^^^^^^^^^^^^^^^^^^^^^^^
Ah, this is not right, we can race with de_thread() which changes the leader,
in particular it does leader->exit_signal = -1 to indicate that this thread is
no longer a group leader, but pid_task() can return the old leader.
We are going to check thread_group_empty() below, it won't be true in this case,
so this race should not make any harm.
Just remove this WARN_ON(). We can't use has_group_leader_pid(), it can return
false if pid_task() returns the new leader.
Otherwise I see no problems.
Oleg.
next prev parent reply other threads:[~2019-05-01 15:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 16:21 [PATCH v2 1/2] Add polling support to pidfd Joel Fernandes (Google)
2019-04-30 16:21 ` [PATCH v2 2/2] Add selftests for pidfd polling Joel Fernandes (Google)
2019-04-30 19:20 ` Christian Brauner
2019-05-14 15:17 ` Christian Brauner
2019-04-30 19:07 ` [PATCH v2 1/2] Add polling support to pidfd Christian Brauner
2019-05-01 15:13 ` Oleg Nesterov [this message]
2019-05-02 15:13 ` Christian Brauner
2019-05-02 16:02 ` Oleg Nesterov
2019-05-02 19:14 ` Joel Fernandes
2019-05-02 19:35 ` Christian Brauner
2019-05-14 15:16 ` Christian Brauner
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=20190501151312.GA30235@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bl0pbl33p@gmail.com \
--cc=christian@brauner.io \
--cc=dancol@google.com \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=joel@joelfernandes.org \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=ktsanaktsidis@zendesk.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=serge@hallyn.com \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=timmurray@google.com \
--cc=torvalds@linux-foundation.org \
--cc=tycho@tycho.ws \
--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