@@ -222,6 +222,36 @@ is only put once the task is reaped.
222222
223223** Use-Case:** Store meta information alongside pidfds.
224224
225+ ### ` CLONE_PIDFD_AUTOKILL ` semantics for PID 1
226+
227+ Allow obtaining a ` CLONE_PIDFD_AUTOKILL ` pidfd for PID 1. Currently
228+ PID 1 cannot hand off an autokill pidfd for itself. Allowing this would
229+ make it possible to create system-death-traps where the lifetime of
230+ PID 1 is tied to another process. PID 1 creates a ` CLONE_PIDFD_AUTOKILL `
231+ pidfd for itself, hands it off to another task, and closes its own copy.
232+ If that other task exits, PID 1 is taken down.
233+
234+ ** Use-Case:** Tie the lifetime of PID 1 to a critical process such as a
235+ software TPM or other security-sensitive daemon. This ensures the system
236+ is brought down if the critical process dies, rather than continuing to
237+ run in a potentially compromised state.
238+
239+ ** Considerations:** When PID 1 is spawned there is no mechanism to start
240+ it with a pidfd right away. There are two possible approaches:
241+
242+ 1 . Place a pidfd at file descriptor position 3 in PID 1's file descriptor
243+ table before ` exec() ` , similar to how the coredump usermodehelper works.
244+ After ` exec() ` PID 1 knows that it already has an autokill pidfd for
245+ itself opened at fd 3.
246+
247+ 2 . Allow opening an autokill pidfd via ` pidfd_open() ` . This would require
248+ mutual exclusion with ` CLONE_PIDFD_AUTOKILL ` : if an autokill pidfd
249+ already exists from ` clone3() ` then no new autokill pidfd can be
250+ created via ` pidfd_open() ` . This guarantees clean semantics.
251+
252+ Permission checking would have to be strict. It should probably only be
253+ allowed for the current thread-group leader on itself.
254+
225255### inotify() events for BSD file locks
226256
227257BSD file locks (i.e. ` flock() ` , as opposed to POSIX ` F_SETLK ` and
0 commit comments