public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PID namespace init releases its file locks before its children die
@ 2025-10-02 18:22 Demi Marie Obenour
  2025-10-03 12:38 ` Oleg Nesterov
  0 siblings, 1 reply; 4+ messages in thread
From: Demi Marie Obenour @ 2025-10-02 18:22 UTC (permalink / raw)
  To: Linux kernel mailing list, Andrew Morton


[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-07 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 18:22 PID namespace init releases its file locks before its children die Demi Marie Obenour
2025-10-03 12:38 ` Oleg Nesterov
2025-10-03 17:09   ` Demi Marie Obenour
2025-10-07 12:02   ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox