@@ -203,6 +203,36 @@ is only put once the task is reaped.
203203
204204** Use-Case:** Store meta information alongside pidfds.
205205
206+ ### ` CLONE_PIDFD_AUTOKILL ` semantics for PID 1
207+
208+ Allow obtaining a ` CLONE_PIDFD_AUTOKILL ` pidfd for PID 1. Currently
209+ PID 1 cannot hand off an autokill pidfd for itself. Allowing this would
210+ make it possible to create system-death-traps where the lifetime of
211+ PID 1 is tied to another process. PID 1 creates a ` CLONE_PIDFD_AUTOKILL `
212+ pidfd for itself, hands it off to another task, and closes its own copy.
213+ If that other task exits, PID 1 is taken down.
214+
215+ ** Use-Case:** Tie the lifetime of PID 1 to a critical process such as a
216+ software TPM or other security-sensitive daemon. This ensures the system
217+ is brought down if the critical process dies, rather than continuing to
218+ run in a potentially compromised state.
219+
220+ ** Considerations:** When PID 1 is spawned there is no mechanism to start
221+ it with a pidfd right away. There are two possible approaches:
222+
223+ 1 . Place a pidfd at file descriptor position 3 in PID 1's file descriptor
224+ table before ` exec() ` , similar to how the coredump usermodehelper works.
225+ After ` exec() ` PID 1 knows that it already has an autokill pidfd for
226+ itself opened at fd 3.
227+
228+ 2 . Allow opening an autokill pidfd via ` pidfd_open() ` . This would require
229+ mutual exclusion with ` CLONE_PIDFD_AUTOKILL ` : if an autokill pidfd
230+ already exists from ` clone3() ` then no new autokill pidfd can be
231+ created via ` pidfd_open() ` . This guarantees clean semantics.
232+
233+ Permission checking would have to be strict. It should probably only be
234+ allowed for the current thread-group leader on itself.
235+
206236### inotify() events for BSD file locks
207237
208238BSD file locks (i.e. ` flock() ` , as opposed to POSIX ` F_SETLK ` and
0 commit comments