qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: Fix guest signal remapping after adjusting SIGABRT
@ 2023-10-27 22:11 Richard Henderson
  2023-10-30 20:26 ` Alex Bennée
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2023-10-27 22:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: christophe.lyon, laurent

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
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/signal.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 3b8efec89f..b35d1e512f 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -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. */
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] linux-user: Fix guest signal remapping after adjusting SIGABRT
  2023-10-27 22:11 [PATCH] linux-user: Fix guest signal remapping after adjusting SIGABRT Richard Henderson
@ 2023-10-30 20:26 ` Alex Bennée
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Bennée @ 2023-10-30 20:26 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, christophe.lyon, laurent

Richard Henderson <richard.henderson@linaro.org> writes:

> 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
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-30 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27 22:11 [PATCH] linux-user: Fix guest signal remapping after adjusting SIGABRT Richard Henderson
2023-10-30 20:26 ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).