]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Fix guest signal remapping after adjusting SIGABRT
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 27 Oct 2023 22:03:08 +0000 (22:03 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 30 Oct 2023 20:40:35 +0000 (13:40 -0700)
The arithmetic within the loop was not adjusted properly after SIGRTMIN
was stolen for the guest SIGABRT.  The effect was that the guest libc
could not send itself __SIGRTMIN to wake sleeping threads.

Fixes: 38ee0a7dfb4b ("linux-user: Remap guest SIGABRT")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1967
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/signal.c

index 3b8efec89fee75e6925af25e0bdb1cd64dd8501b..b35d1e512fbfb04773b9151d650e46def48f0af6 100644 (file)
@@ -536,11 +536,10 @@ static void signal_table_init(void)
     host_to_target_signal_table[SIGABRT] = 0;
     host_to_target_signal_table[hsig++] = TARGET_SIGABRT;
 
-    for (; hsig <= SIGRTMAX; hsig++) {
-        tsig = hsig - SIGRTMIN + TARGET_SIGRTMIN;
-        if (tsig <= TARGET_NSIG) {
-            host_to_target_signal_table[hsig] = tsig;
-        }
+    for (tsig = TARGET_SIGRTMIN;
+         hsig <= SIGRTMAX && tsig <= TARGET_NSIG;
+         hsig++, tsig++) {
+        host_to_target_signal_table[hsig] = tsig;
     }
 
     /* Invert the mapping that has already been assigned. */