user-level: 0.931 graphic: 0.900 performance: 0.870 ppc: 0.824 kernel: 0.813 mistranslation: 0.726 device: 0.724 semantic: 0.717 x86: 0.692 architecture: 0.669 risc-v: 0.657 vnc: 0.642 peripherals: 0.623 network: 0.621 assembly: 0.619 socket: 0.613 hypervisor: 0.608 arm: 0.605 PID: 0.566 debug: 0.556 files: 0.540 permissions: 0.538 KVM: 0.525 i386: 0.465 boot: 0.459 VMM: 0.448 register: 0.432 TCG: 0.430 virtual: 0.280 -------------------- user-level: 0.868 kernel: 0.655 x86: 0.152 hypervisor: 0.142 debug: 0.073 virtual: 0.058 PID: 0.024 files: 0.019 TCG: 0.015 semantic: 0.010 register: 0.007 architecture: 0.004 performance: 0.003 device: 0.003 ppc: 0.002 i386: 0.002 network: 0.002 KVM: 0.002 peripherals: 0.002 socket: 0.001 boot: 0.001 VMM: 0.001 permissions: 0.001 graphic: 0.001 mistranslation: 0.000 assembly: 0.000 vnc: 0.000 risc-v: 0.000 arm: 0.000 linux-user: fails to deliver signals raised during pselect Description of problem: When run via qemu a program which blocks signals but unmasks them during `pselect` does not catch these signals when returning from `pselect`. Used as reference on expected behavior: [The new pselect() system call](https://lwn.net/Articles/176911/) Steps to reproduce: A minimal test case below mimics behavior as encountered in the test suite of `p11-kit` ([link](https://github.com/p11-glue/p11-kit)) (which attempts to catch `SIGTERM` in a similar way and results in lingering processes after running the test suite). ```C #include #include #include #include static void handler(int sig) { puts("SIGNAL"); } int main(int argc, char *argv[]) { struct sigaction sa; fd_set rfds; sigset_t emptyset, blockset; sigemptyset (&blockset); sigemptyset (&emptyset); sigaddset (&blockset, SIGUSR1); sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGUSR1, &sa, NULL); sigprocmask (SIG_BLOCK, &blockset, NULL); FD_ZERO(&rfds); while(1) { pselect(0, &rfds, NULL, NULL, NULL, &emptyset); } return 0; } ``` Running this without qemu should print _SIGNAL_ when sent `SIGUSR1`: ``` $ ./a.out & [1] 1683587 $ kill -USR1 %1 $ SIGNAL ``` When run with `qemu-x86_64` however, it does not (also qemu's `-strace` confirms the signal isn't received whereas a strace of qemu shows it's in fact delivered). The pselect call itself _is_ interrupted, but the signal goes missing.