Adds a pending-signal check to avoid attempting to run a syscall for a signal arriving in the cache, avoiding running pre-syscall handling only to abort and have complications with undoing or duplicating actions.
For a signal arriving in DR while executing a syscall, changes DR to go ahead and do the syscall for all non-ignorable syscalls, again avoiding complications with undoing or duplicating pre-syscall action. Previously, this was only done for sigreturn or clone syscalls. Non-ignorable syscalls generally do not block, so this should not impact signal delivery delays.
Moves the pending-signal check to be the first thing checked for the exit reason, for proper exit attribution.
Avoids the IBT add code for a pending-signal exit.
Tested on the large proprietary app where the wrong exit reasons were first observed. Adding a regression suite test for these asynchronous signal conditions is not easy unfortunately.
Issue: #4878 (closed), #4884 (closed) Fixes: #4884 (closed)