Disables rerouting of blocked alarm signals while inside an app handler. This is not bulletproof: I have it considering the handler as exited if we see sigreturn or sigprocmask, but there is no requirement that the app use either siglongjmp or sigreturn to exit a handler and to not use sigprocmask inside the handler. But, if we get it wrong, it will fall back to not rerouting alarms at all, which we can live with as those are typically not used as required messages and routed to a single thread.
The rerouting of alarms was seen to cause problems on large apps where normally they can accumulate due to DR overhead causing a new one to arrive while still in the handler for theprior one. Rerouting sent them to new threads, rather than marking pending and dropping if several accumulated.
Adds an on-by-default option -reroute_alarm_signals that can be used to disable routing of all alarm signals.
Adds a test to linux.sigmask which fails without this change.
The test was not easy to set up and it revealed two bugs in the rerouting, which are fixed here:
- Don't re-route synchronous fault signals.
- Properly re-route receive-now signals.
Adds a new rstat counting rerouted signals.
Issue: #2311