mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 05:05:36 +00:00
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. Backports commit 21a43af0f18335af4abb1959aa28ee9d159a2d43 from qemu
This commit is contained in:
parent
55bc017af4
commit
03beb4f15a
|
@ -49,6 +49,11 @@ int qemu_thread_create(struct uc_struct *uc, QemuThread *thread, const char *nam
|
||||||
|
|
||||||
/* Leave signal handling to the iothread. */
|
/* Leave signal handling to the iothread. */
|
||||||
sigfillset(&set);
|
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);
|
pthread_sigmask(SIG_SETMASK, &set, &oldset);
|
||||||
err = pthread_create(&thread->thread, &attr, start_routine, arg);
|
err = pthread_create(&thread->thread, &attr, start_routine, arg);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue