vfs pidfs
Christian Brauner
maintainerHey Linus,
/* Summary */
This adds a new ioctl to retrieve information about a pidfd.
A common pattern when using pidfds is having to get information about the process, which currently requires /proc being mounted, resolving the fd to a pid, and then do manual string parsing of /proc/N/status and friends. This needs to be reimplemented over and over in all userspace projects (e.g.: it has been reimplemented in systemd, dbus, dbus-daemon, polkit so far), and requires additional care in checking that the fd is still valid after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct so that more parameters can be added later if needed. Start with returning pid/tgid/ppid and some creds unconditionally, and cgroupid optionally.
/* Testing */
gcc version 14.2.0 (Debian 14.2.0-6)
Debian clang version 16.0.6 (27+b1)
All patches are based on v6.12-rc3 and have been sitting in linux-next. No build failures or warnings were observed.
/* Conflicts */
Merge conflicts with mainline
=============================
No known conflicts.
Merge conflicts with other trees
================================
No known conflicts.
The following changes since commit 8e929cb546ee42c9a61d24fae60605e9e3192354:
Linux 6.12-rc3 (2024-10-13 14:33:32 -0700)
are available in the Git repository at:
[email protected]:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.13.pidfs
for you to fetch changes up to cdda1f26e74bac732eca537a69f19f6a37b641be:
pidfd: add ioctl to retrieve pid info (2024-10-24 13:54:51 +0200)
Please consider pulling these changes from the signed vfs-6.13.pidfs tag.
Thanks!
Christian
----------------------------------------------------------------
vfs-6.13.pidfs
----------------------------------------------------------------
Luca Boccassi (1):
pidfd: add ioctl to retrieve pid info
fs/pidfs.c | 86 ++++++++++++++++++++++++- include/uapi/linux/pidfd.h | 50 ++++++++++++++ tools/testing/selftests/pidfd/pidfd_open_test.c | 82 ++++++++++++++++++++++- 3 files changed, 214 insertions(+), 4 deletions(-)
The pull request you sent on Fri, 15 Nov 2024 15:04:33 +0100:
The pull request you sent on Fri, 15 Nov 2024 15:04:33 +0100:
Quoted 1 line
[email protected]:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.13.pidfs
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/909d3b571e5a77aef0949818de1efda129dcddbd
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html