qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 6/7] linux-user: Handle SIGSEGV/SIGBUS in host_to_target_sigi


From: Richard Henderson
Subject: [RFC PATCH 6/7] linux-user: Handle SIGSEGV/SIGBUS in host_to_target_siginfo_noswap
Date: Mon, 13 Sep 2021 15:05:51 -0700

Remap the faulting address from the host address space into
the guest address space.

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

diff --git a/linux-user/signal.c b/linux-user/signal.c
index a8faea6f09..73c0f9066b 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -405,6 +405,15 @@ static inline void 
host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
             tinfo->_sifields._sigpoll._fd = info->si_fd;
             si_type = QEMU_SI_POLL;
             break;
+        case TARGET_SIGSEGV:
+        case TARGET_SIGBUS:
+            /*
+             * Remap the host address into the target space.
+             * Even an invalid guest address is still valid for a fault.
+             */
+            tinfo->_sifields._sigfault._addr = h2g_nocheck(info->si_addr);
+            si_type = QEMU_SI_FAULT;
+            break;
         default:
             /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
             tinfo->_sifields._rt._pid = info->si_pid;
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]