]> git.ipfire.org Git - thirdparty/util-linux.git/commit
kill: add support for race-free process kills using pidfd inodes
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Mon, 25 Aug 2025 18:04:19 +0000 (14:04 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 2 Sep 2025 22:51:31 +0000 (18:51 -0400)
commit39a42a53625c6cf2b6d8cb64394db97267962b44
treeb1c20e40d08391f385145735c5e36f2b3438614c
parentc407a13fc1f5842881c967d0132035c7db442d4a
kill: add support for race-free process kills using pidfd inodes

The 6.9 Linux kernel added support for pidfds which introduces inodes
that stay unique for the system lifetime and can be used to reference
a process with both its traditional pid and pid fd inode number.
This enables race-free killing of processes and protects from false
referencing due to pid rollovers.

This patch adds a new way of addressing processes with the format
'pid:pidfd_inode'. When the new format is used, 'kill' assumes the user wishes
to use a pidfd to signal a process, and will therefore use pidfd_* routines
to complete the task if the provided inode matches the one from a previously
acquired pidfd.

Addresses: #3252
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
14 files changed:
include/Makemodule.am
include/pidutils.h [new file with mode: 0644]
lib/Makemodule.am
lib/meson.build
lib/pidutils.c [new file with mode: 0644]
meson.build
misc-utils/kill.1.adoc
misc-utils/kill.c
tests/commands.sh
tests/expected/build-sys/config-all-devel
tests/expected/kill/pidfdino [new file with mode: 0644]
tests/helpers/Makemodule.am
tests/helpers/test_kill_pidfdino.c [new file with mode: 0644]
tests/ts/kill/pidfdino [new file with mode: 0755]