On 02/28, Christian Brauner wrote: > > Some tools like systemd's jounral need to retrieve the exit and cgroup > information after a process has already been reaped. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ But unless I am totally confused do_exit() calls pidfd_exit() even before exit_notify(), the exiting task is not even zombie yet. It will reaped only when it passes exit_notify() and its parent does wait(). And what about the multi-threaded case? Suppose the main thread does sys_exit(0) and it has alive sub-threads. In this case pidfd_info() will report kinfo.exit_code = 0. And this is probably fine if (file->f_flags & PIDFD_THREAD) != 0. But what if this file was created without PIDFD_THREAD? If another thread does exit_group(1) after that, the process's exit code is 1 << 8, but it can't be retrieved. Finally, sys_execve(). Suppose we have a main thread L and a sub-thread T. T execs and kill the leader L. L exits and populates pidfs_i(inode)->exit_info. T calls exchange_tids() in de_thread() and becomes the new leader with the same (old) pid. Now, T is very much alive, but pidfs_i(inode)->exit_info != NULL. Or I am totally confused? > + exit_info = READ_ONCE(pidfs_i(inode)->exit_info); > + if (exit_info) { > + /* > + * TODO: Oleg, I didn't see a reason for putting > + * retrieval of the exit status of a task behind some > + * form of permission check. Neither me. Oleg.