qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH] linux-user: trap internal SIGABRT's


From: Richard Henderson
Subject: Re: [RFC PATCH] linux-user: trap internal SIGABRT's
Date: Thu, 10 Feb 2022 08:56:46 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/9/22 22:22, Alex Bennée wrote:
linux-user wants to trap all signals in case they are related to the
guest. This however results in less than helpful core dumps when the
error is internal to QEMU. We can detect when an assert failure is in
progress by examining __glib_assert_msg and fall through to
cpu_abort() which will pretty print something before restoring the
default SIGABRT behaviour and dumping core.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  linux-user/signal.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 32854bb375..8ecc1215f7 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -809,6 +809,8 @@ static inline void rewind_if_in_safe_syscall(void *puc)
      }
  }
+GLIB_VAR char *__glib_assert_msg;
+
  static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
  {
      CPUArchState *env = thread_cpu->env_ptr;
@@ -821,6 +823,10 @@ static void host_signal_handler(int host_sig, siginfo_t 
*info, void *puc)
      uintptr_t pc = 0;
      bool sync_sig = false;
+ if (__glib_assert_msg) {
+        cpu_abort(cpu, "internal QEMU error, aborting...");
+    }

I think we should not be trapping SIGABRT. I think we can preserve all guest behaviour wrt SIGABRT by stealing another SIGRTMIN value, and remapping the guest signal number. We can produce the correct result for the system by mapping it back to host SIGABRT in core_dump_and_abort().


r~



reply via email to

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