Przeglądaj źródła

[Pal/Linux] Block async signals on thread exiting

After the Linux PAL frees the thread's signal stack and TCB but before
the thread is actually destroyed by Linux, an arriving async signal on
this thread will result in a segfault. This commit simply blocks all
async signals before proceeding with freeing thread's resources.
Isaku Yamahata 6 lat temu
rodzic
commit
951219cac7
1 zmienionych plików z 1 dodań i 0 usunięć
  1. 1 0
      Pal/src/host/Linux/db_threading.c

+ 1 - 0
Pal/src/host/Linux/db_threading.c

@@ -173,6 +173,7 @@ noreturn void _DkThreadExit (void)
     PAL_TCB_LINUX* tcb = get_tcb_linux();
     PAL_TCB_LINUX* tcb = get_tcb_linux();
     PAL_HANDLE handle = tcb->handle;
     PAL_HANDLE handle = tcb->handle;
 
 
+    block_async_signals(true);
     if (tcb->alt_stack) {
     if (tcb->alt_stack) {
         stack_t ss;
         stack_t ss;
         ss.ss_sp    = NULL;
         ss.ss_sp    = NULL;