summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-10-28 07:55:38 +0100
committerSam James <sam@gentoo.org>2022-10-28 07:56:02 +0100
commit1df78d697b62b92988a676d7a89714f9bf1f9716 (patch)
tree14ab2d5b1ea4d62cac171c1da75d94e5ed1bbbce /sys-process/psmisc/files
parentsys-process/psmisc: add missing dejagnu test dep (diff)
downloadgentoo-1df78d697b62b92988a676d7a89714f9bf1f9716.tar.gz
gentoo-1df78d697b62b92988a676d7a89714f9bf1f9716.tar.bz2
gentoo-1df78d697b62b92988a676d7a89714f9bf1f9716.zip
sys-process/psmisc: add 23.5
Closes: https://bugs.gentoo.org/802414 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-process/psmisc/files')
-rw-r--r--sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch b/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch
new file mode 100644
index 000000000000..0fc9c30a9635
--- /dev/null
+++ b/sys-process/psmisc/files/psmisc-23.5-fix-killall-pidfd_send_signal.patch
@@ -0,0 +1,40 @@
+https://gitlab.com/psmisc/psmisc/-/commit/6892e321e7042e3df60a5501a1c59d076e8a856f
+
+From 6892e321e7042e3df60a5501a1c59d076e8a856f Mon Sep 17 00:00:00 2001
+From: Craig Small <csmall@dropbear.xyz>
+Date: Mon, 18 Jul 2022 20:16:42 +1000
+Subject: [PATCH] killall: use kill if pidfd_send_signal() fails
+
+The pidfd_send_signal() system call appeared in Linux 5.1
+If psmisc is build on a system before then, or a non-Linux
+system, then kill() is used instead. However if psmisc is
+built on a Linux >= 5.1 system but run on a < 5.1 Linux
+system the system call fails and killall doesn't work.
+
+The fix, as proposed by Peter T. Breuer, is to try
+pidfd_send_signal() and if the return value is < 0 and
+errno is ENOSYS then we know at runtime the system call
+failed and we fall through to trusty old kill().
+
+Note, this means that killall on systems below 5.1 still
+have the race PID condition that the pidfd calls fix.
+
+References:
+ https://bugs.debian.org/1015228
+--- a/src/killall.c
++++ b/src/killall.c
+@@ -326,7 +326,12 @@ my_send_signal(
+ {
+ #ifdef __NR_pidfd_send_signal
+ if (pid > 0) /* Not PGID */
+- return syscall(__NR_pidfd_send_signal, pidfd, sig, NULL, 0);
++ {
++ int ret = syscall(__NR_pidfd_send_signal, pidfd, sig, NULL, 0);
++ if (ret >= 0 || errno != ENOSYS)
++ return ret;
++ // fall through if no such syscall
++ }
+ #endif
+ return kill(pid, sig);
+ }
+GitLab