Consider moving most of signal handling to userspace
Currently, signal handling is done mostly in the kernel, and lacks important features (such as sending arguments to signal handlers). Additionally, the signal trampoline is done in the kernel, where the entire kernel stack is copied, which is ugly and probably a bit UB.
It would be possible to put the sigprocmask and pending mask in shared memory. Thus, while SYS_KILL
ers may need exclusive access to that shared memory, the sigprocmask and pending mask can be accessed using atomics, by storing sigmask[i] and pending[i] striped in the same atomic word.