From: Demi Marie Obenour <demiobenour@gmail.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: PID namespace init releases its file locks before its children die
Date: Thu, 2 Oct 2025 14:22:30 -0400 [thread overview]
Message-ID: <58ac5d49-14a9-4fe6-a5a4-746d6b73f82b@gmail.com> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 818 bytes --]
I noticed that PID 1 in a PID namespace can release file locks (due
to exiting) while its children are still running for a bit. If the
locks held by PID 1 were relied to serialize the execution of its
child processes, this could result in data corruption.
Specifically, the child processes are killed via exit_notify() ->
forget_original_parent() -> find_child_reaper() ->
zap_pid_ns_processes(). That comes *after* exit_files(), which
releases the file locks.
While it is possible to implement this with cgroups, cgroups
are quite a bit more complicated to use, at least compared to
a single call to unshare() before fork().
Is this intentional? Changing the behavior would make supervision
trees significantly easier to properly implement.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2025-10-02 18:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 18:22 Demi Marie Obenour [this message]
2025-10-03 12:38 ` Oleg Nesterov
2025-10-03 17:09 ` Demi Marie Obenour
2025-10-07 12:02 ` 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=58ac5d49-14a9-4fe6-a5a4-746d6b73f82b@gmail.com \
--to=demiobenour@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®