diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-04-25 10:11:30 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-04-26 08:27:33 +0200 |
| commit | 477058411c45f225ddfbb4769e35a9a5a95cb826 (patch) | |
| tree | 3bd3301cb35f7032980a66b347bbf4997e47d8c7 /include | |
| parent | b590c928cca7bdc7fd580d52e42bfdc3ac5eeacb (diff) | |
pidfs: register pid in pidfs
Add simple helpers that allow a struct pid to be pinned via a pidfs
dentry/inode. If no pidfs dentry exists a new one will be allocated for
it. A reference is taken by pidfs on @pid. The reference must be
released via pidfs_put_pid().
This will allow AF_UNIX sockets to allocate a dentry for the peer
credentials pid at the time they are recorded where we know the task is
still alive. When the task gets reaped its exit status is guaranteed to
be recorded and a pidfd can be handed out for the reaped task.
Link: https://lore.kernel.org/20250425-work-pidfs-net-v2-1-450a19461e75@kernel.org
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: David Rheinsberg <david@readahead.eu>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/pidfs.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pidfs.h b/include/linux/pidfs.h index 05e6f8f4a026..2676890c4d0d 100644 --- a/include/linux/pidfs.h +++ b/include/linux/pidfs.h @@ -8,5 +8,8 @@ void pidfs_add_pid(struct pid *pid); void pidfs_remove_pid(struct pid *pid); void pidfs_exit(struct task_struct *tsk); extern const struct dentry_operations pidfs_dentry_operations; +int pidfs_register_pid(struct pid *pid); +void pidfs_get_pid(struct pid *pid); +void pidfs_put_pid(struct pid *pid); #endif /* _LINUX_PID_FS_H */ |
