diff options
author | Roman Bolshakov <r.bolshakov@yadro.com> | 2018-12-17 23:26:02 +0300 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-01-08 12:34:46 +0000 |
commit | 21a43af0f18335af4abb1959aa28ee9d159a2d43 (patch) | |
tree | 352ccb7bfcfdc34fcdcf3647122fde054a5dd74a /util | |
parent | 479a57475ec93390e647ed760c38b2120fef5f58 (diff) | |
download | qemu-21a43af0f18335af4abb1959aa28ee9d159a2d43.zip qemu-21a43af0f18335af4abb1959aa28ee9d159a2d43.tar.gz qemu-21a43af0f18335af4abb1959aa28ee9d159a2d43.tar.bz2 |
qemu-thread: Don't block SEGV, ILL and FPE
If any of these signals happen on macOS, they are not delivered to other
threads and signalfd_compat receives nothing. Indeed, POSIX reference
and sigprocmask(2) note that an attempt to block the signals results in
undefined behaviour. SEGV and FPE can't also be received by signalfd(2)
on Linux.
An ability to retrieve SIGBUS via signalfd(2) is used by QEMU for
memory preallocation therefore we can't unblock it without consequences.
But it's important to leave a remark that the signal is lost on macOS.
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/qemu-thread-posix.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index c6934bd..1bf5e65 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -524,6 +524,11 @@ void qemu_thread_create(QemuThread *thread, const char *name, /* Leave signal handling to the iothread. */ sigfillset(&set); + /* Blocking the signals can result in undefined behaviour. */ + sigdelset(&set, SIGSEGV); + sigdelset(&set, SIGFPE); + sigdelset(&set, SIGILL); + /* TODO avoid SIGBUS loss on macOS */ pthread_sigmask(SIG_SETMASK, &set, &oldset); qemu_thread_args = g_new0(QemuThreadArgs, 1); |