Puts in place 6 fixes for handling signals during DR initialization, typically in a start/stop setup where other threads are alive.
-
Copy the app handler at init time for delivering native signals during init.
-
Reorder signal_arch_init(), which obtains the signal frame size, to run before DR installs its handler.
-
Obtains the app handler before installing DR's handler, eliminating a (narrow) race window.
-
Until DR starts executing the app, continues delivering native signals and using the globally recorded app handler, to match how DR init works.
-
Set detacher_tid between init and setup to avoid races like in DR's handler at the end of init that were under #3535 (closed)
-
Handle a race where the init thread has set the global try_except, causing master_signal_handler_C to think an app thread's signal is DR's. We add a global_try_tid and check the thread id to solve this.
Augments api.detach_signal with signals sent during init.
Also tested on a large proprietary application.
Issue: #1921 (closed), #3535 (closed)