FEX icon indicating copy to clipboard operation
FEX copied to clipboard

WIP: Guest Signals: Correctly block raised signal, implement SA_NODEFER, sigreturn sa_mask restore

Open skmp opened this issue 3 years ago • 1 comments

Overview

This is the first set of fixes from #1682

  • The raised signal in the guest handler would not be blocked. As the host handler does sigreturn, we can't rely on the host handling there.
  • Also implemented guest SA_NODEFER there.
  • On guest signal return, the guest provided uc_sigmask is restored, not the one saved on signal entry, as the guest can modify this.

TODO

  • [ ] Cleanup the code
  • [ ] move more of the signal logic away from the jit dispatcher
  • [ ] Make sure we don't set SA_NODEFER for the host signals, as we don't want that there
  • [ ] Integrate tests from https://github.com/FEX-Emu/fex-assorted-tests-bins/tree/main/src/tests

Test todo

  • [ ] Add test for procmask inside signal handler, with and without SA_NODEFER
  • [ ] Add test for procmask after signal handler, with and without SA_NODEFER
  • [ ] SA_NODEFER tests validating around host signal handling
  • [ ] Verify guest_uctx sigmask is set correctly before entry to signal handler

skmp avatar May 24 '22 18:05 skmp

Interestingly enough, we did have a (partially working) implementation of half the fixes there, that somehow failed to work during my tests, but works now? Peculiar.

The signal mask setting still needs to be fixed though.

skmp avatar Jun 10 '22 05:06 skmp

(Closing this as there is an ongoing powergrab by @Sonicadvance1, I will migrate my work to https://github.com/skmp/fex-emu-ng.git)

skmp avatar Sep 01 '22 14:09 skmp