Stefanos Kornilios Mitsis Poiitidis
Stefanos Kornilios Mitsis Poiitidis
(Updated with more details about signal latency, execution overshoot, and signal queue merging)
Apart from blocking signals during critical sections with signal deferring we can handle the signal after the critical section, or at specific signal handling spots. This greatly reduces the complexity...
Another complication are signals that cannot be blocked or caught, namely SIGKILL and SIGSTOP. While these are not as much of an issue when (a) targeted to the process itself,...
Another edge case that we have to consider is the host side of a thunked library registering signals handlers.
(Deferred signals investigation is in https://github.com/FEX-Emu/FEX/issues/1666, will update here with a summary here once that is closed)
Another edge case is how to handle cpu state reconstruction around thunks. Of course, reconstructing context is impossible if we deliver the signal while the thunk is running. Also, depending...
### On storing the host context and returning with `rt_sigreturn` Based on the linux source (https://elixir.bootlin.com/linux/latest/source/arch/x86/include/uapi/asm/sigcontext.h#L1920) ``` struct sigframe { char __user *pretcode; int sig; struct sigcontext sc; struct _xstate...
Defining some terms here to make things more understandable. #### `(fully/plausibly/not) redispatchable [guest state]` A state we can redispatch / recompile and the guest would not be able to detect...
Reading our code, we generate the context in the guest stack by reading RSP, without any reconstruction, will can lead us overwriting the guest stack. We back off 128 bytes...
~~Redzone may be applied both for 32-bit and 64-bit processes in a 64-bit kernel. Source: https://elixir.bootlin.com/linux/latest/source/arch/x86/kernel/signal.c#L252~~ ia32 compat in x64 kernels is in https://elixir.bootlin.com/linux/latest/source/arch/x86/ia32/ia32_signal.c