aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-02-09 15:49:45 +0100
committerChristian Brauner <brauner@kernel.org>2024-02-21 09:46:08 +0100
commite1fb1dc08e73466830612bcf2f9f72180965c9ba (patch)
treeb39e0470adfe3fc531c064f14cc60601b5af6a6d /include/uapi
parentpidfd: change pidfd_send_signal() to respect PIDFD_THREAD (diff)
downloadlinux-e1fb1dc08e73466830612bcf2f9f72180965c9ba.tar.gz
linux-e1fb1dc08e73466830612bcf2f9f72180965c9ba.zip
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 [1] 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>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/pidfd.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/uapi/linux/pidfd.h b/include/uapi/linux/pidfd.h
index 2e6461459877..72ec000a97cd 100644
--- a/include/uapi/linux/pidfd.h
+++ b/include/uapi/linux/pidfd.h
@@ -10,4 +10,9 @@
#define PIDFD_NONBLOCK O_NONBLOCK
#define PIDFD_THREAD O_EXCL
+/* Flags for pidfd_send_signal(). */
+#define PIDFD_SIGNAL_THREAD (1UL << 0)
+#define PIDFD_SIGNAL_THREAD_GROUP (1UL << 1)
+#define PIDFD_SIGNAL_PROCESS_GROUP (1UL << 2)
+
#endif /* _UAPI_LINUX_PIDFD_H */