Package: procps
Version: 2:4.0.7-1.1
Severity: important
User: [email protected]
Usertags: hurd
Dear Maintainer,
On hurd-i386, pkill from procps 2:4.0.7-1.1 terminates with SIGILL (exit
status 132) as soon as it matches a process, and the matched process
receives no signal. pgrep, and pkill with no match (exit status 1), work.
Reproduction (hurd-i386, GNU Mach 1.8+git20261028, hurd
1:0.9.git20261028-4, libc0.3 2.43-7~hurd.1):
$ sleep 600 &
$ pkill -x sleep; echo $?
Illegal instruction (core dumped)
132
$ pkill -0 -x sleep; echo $? # signal number does not matter
Illegal instruction
132
gdb stops in glibc's syscall() with the Linux pidfd_open number in eax:
Thread 2 received signal SIGILL, Illegal instruction.
syscall () at ../sysdeps/mach/i386/syscall.S:25
eax 0x1b2 434
=> <syscall+10>: pop %ecx (the instruction after lcall $7,$0)
Mechanism, from source:
1. Since upstream commit f8d36fd3 ("pgrep: use pidfd_send_signal",
first released in 4.0.6), pkill calls pidfd_open() for every matched
process (src/pgrep.c, 4.0.7 line 1422). In 4.0.4 and 4.0.5,
pidfd_open() was used only by pidwait, which is not built here.
2. When HAVE_PIDFD_OPEN is undefined, as on the Hurd, src/pgrep.c
defines SYS_pidfd_open as 434 (544 on alpha) and calls
syscall(SYS_pidfd_open, ...). pidfd_send_signal() (424) and
process_mrelease() (448) take the same route.
3. On i386, glibc's sysdeps/mach/i386/syscall.S makes the call a Mach
trap: it loads the number into eax and executes lcall $7,$0.
4. GNU Mach's syscall_native (i386/i386/locore.S) negates eax; a
positive number goes to mach_call_range, which raises
T_INVALID_OPCODE. glibc's sysdeps/mach/hurd/x86/exc2signal.c maps
EXC_BAD_INSTRUCTION to SIGILL.
execute_kill() in src/pgrep.c already falls back to kill() when
pidfd_send_signal() fails with ENOSYS. A local test build in which the
three helpers set errno to ENOSYS and return -1 when __linux__ is
undefined restores pkill (it exits 0 and the sleep is killed). I mention
this only as evidence of the mechanism; whether the guard belongs in
procps or in glibc's Hurd syscall() is for you and the porters to judge.
The crash is the same under KVM and under QEMU's TCG emulator, so it
does not depend on the virtual CPU.
hurd-amd64 (procps 2:4.0.7-1.1, libc0.3 2.43-7) does not crash. pkill
calls syscall() there with the same number 434, but glibc has no
sysdeps/mach/x86_64/syscall.S, so x86_64 Hurd uses the generic
misc/syscall.c stub: it sets errno to ENOSYS and returns -1, and pkill
falls back to kill().
The stock package was tested directly (procps_2:4.0.7-1.1_hurd-i386.deb,
sha256 9a91f2396a885d454f8b5ca981071b27295f2dc85d18c7c69fe31b89256e9b51),
extracted beside the installed system. Both it and the test build link
libproc2.so.1. I found no existing report in the BTS or upstream;
upstream #352 concerns the 4.0.4 build failure that introduced the
numeric fallback.
-- System Information:
Debian Release: forky/sid (debian-ports snapshot 20261114T183112Z)
Architecture: hurd-i386 (i686-AT386), QEMU guest (KVM and TCG)
Kernel: GNU 0.9 GNU-Mach 1.8+git20261028-up-486/Hurd-0.9
hurd 1:0.9.git20261028-4, libc0.3 2.43-7~hurd.1