From: Frederic Weisbecker <frederic@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Neeraj Upadhyay <quic_neeraju@quicinc.com>,
Pengfei Xu <pengfei.xu@intel.com>,
Boqun Feng <boqun.feng@gmail.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
rcu@vger.kernel.org
Subject: Re: [PATCH 3/3] rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes()
Date: Wed, 7 Dec 2022 21:01:55 +0100 [thread overview]
Message-ID: <20221207200155.GA1840475@lothringen> (raw)
In-Reply-To: <20221206164927.GD3866@redhat.com>
On Tue, Dec 06, 2022 at 05:49:28PM +0100, Oleg Nesterov wrote:
> On 11/30, Eric W. Biederman wrote:
> >
> > 2) I keep thinking zap_pid_ns_processes() should be changed so that
> > after it sends SIGKILL to all of the relevant processes to not wait,
>
> At least I think it should not wait for the tasks injected into this ns.
>
> Because this looks like a kernel bug even if we forget about this deadlock.
>
> Say we create a task P using clone(CLONE_NEWPID), then inject a task T into
> P's pid-namespace via setns/fork. This make the process P "unkillable", it
> will hang in zap_pid_ns_processes() "forever" until T->parent reaps a zombie
> task T killed by P.
I think this was made that way on purpose, see the comment in
zap_pid_ns_processes():
/*
* kernel_wait4() misses EXIT_DEAD children, and EXIT_ZOMBIE
* process whose parents processes are outside of the pid
* namespace. Such processes are created with setns()+fork().
*
* If those EXIT_ZOMBIE processes are not reaped by their
* parents before their parents exit, they will be reparented
* to pid_ns->child_reaper. Thus pidns->child_reaper needs to
* stay valid until they all go away.
*
* The code relies on the pid_ns->child_reaper ignoring
* SIGCHILD to cause those EXIT_ZOMBIE processes to be
* autoreaped if reparented.
*
* Semantically it is also desirable to wait for EXIT_ZOMBIE
* processes before allowing the child_reaper to be reaped, as
* that gives the invariant that when the init process of a
* pid namespace is reaped all of the processes in the pid
* namespace are gone.
I can't say I like the fact that a parent not belonging to a new namespace
can create more than one child within that namespace but anyway this all look
like an ABI that can't be reverted now.
Thanks.
next prev parent reply other threads:[~2022-12-07 20:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 13:54 [PATCH 0/3] rcu-tasks: Fix race against exiting pid_ns Frederic Weisbecker
2022-11-25 13:54 ` [PATCH 1/3] rcu-tasks: Improve comments explaining tasks_rcu_exit_srcu purpose Frederic Weisbecker
2022-11-25 13:54 ` [PATCH 2/3] rcu-tasks: Remove preemption disablement around srcu_read_[un]lock() calls Frederic Weisbecker
2022-11-25 13:55 ` [PATCH 3/3] rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes() Frederic Weisbecker
2022-11-30 18:37 ` Eric W. Biederman
2022-12-02 19:51 ` Paul E. McKenney
2022-12-02 22:54 ` Frederic Weisbecker
2022-12-02 23:28 ` Eric W. Biederman
2022-12-04 0:03 ` Frederic Weisbecker
2022-12-06 16:49 ` Oleg Nesterov
2022-12-07 14:34 ` Paul E. McKenney
2022-12-07 20:01 ` Frederic Weisbecker [this message]
2022-12-07 20:39 ` Oleg Nesterov
2022-12-09 20:26 ` Frederic Weisbecker
2022-11-29 0:22 ` [PATCH 0/3] rcu-tasks: Fix race against exiting pid_ns Paul E. McKenney
2022-11-29 9:55 ` Frederic Weisbecker
2022-11-29 14:48 ` Paul E. McKenney
2022-12-02 22:55 ` Frederic Weisbecker
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=20221207200155.GA1840475@lothringen \
--to=frederic@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=ebiederm@xmission.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@kernel.org \
--cc=pengfei.xu@intel.com \
--cc=quic_neeraju@quicinc.com \
--cc=rcu@vger.kernel.org \
/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