]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pidfd: allow to override signal scope in pidfd_send_signal()
authorChristian Brauner <brauner@kernel.org>
Fri, 9 Feb 2024 14:49:45 +0000 (15:49 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 21 Feb 2024 08:46:08 +0000 (09:46 +0100)
commite1fb1dc08e73466830612bcf2f9f72180965c9ba
treeb39e0470adfe3fc531c064f14cc60601b5af6a6d
parent81b9d8ac0640b285a3c369cd41a85f6c240d3a60
pidfd: allow to override signal scope in pidfd_send_signal()

Right now we determine the scope of the signal based on the type of
pidfd. There are use-cases where it's useful to override the scope of
the signal. For example in [1]. Add flags to determine the scope of the
signal:

(1) PIDFD_SIGNAL_THREAD: send signal to specific thread reference by @pidfd
(2) PIDFD_SIGNAL_THREAD_GROUP: send signal to thread-group of @pidfd
(2) PIDFD_SIGNAL_PROCESS_GROUP: send signal to process-group of @pidfd

Since we now allow specifying PIDFD_SEND_PROCESS_GROUP for
pidfd_send_signal() to send signals to process groups we need to adjust
the check restricting si_code emulation by userspace to account for
PIDTYPE_PGID.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Link: https://github.com/systemd/systemd/issues/31093
Link: https://lore.kernel.org/r/20240210-chihuahua-hinzog-3945b6abd44a@brauner
Link: https://lore.kernel.org/r/20240214123655.GB16265@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/uapi/linux/pidfd.h
kernel/signal.c