Print this page
OS-4470 lxbrand unblocking signals in new threads must be atomic
        
*** 1555,1567 ****
          /*
           * These variables must be "volatile", as they are modified after the
           * getcontext() stores the register state:
           */
          volatile boolean_t signal_delivered = B_FALSE;
!         volatile uintptr_t lxfp;
!         volatile uintptr_t old_tsd_sp;
!         volatile int newstack;
  
          /*
           * This function involves modifying the Linux process stack for this
           * thread.  To do so without corruption requires us to exclude other
           * signal handlers (or emulated system calls called from within those
--- 1555,1567 ----
          /*
           * These variables must be "volatile", as they are modified after the
           * getcontext() stores the register state:
           */
          volatile boolean_t signal_delivered = B_FALSE;
!         volatile uintptr_t lxfp = 0;
!         volatile uintptr_t old_tsd_sp = 0;
!         volatile int newstack = 0;
  
          /*
           * This function involves modifying the Linux process stack for this
           * thread.  To do so without corruption requires us to exclude other
           * signal handlers (or emulated system calls called from within those
*** 1803,1819 ****
                  LX_REG(&jump_uc, REG_RDI) = hargs[0];
                  LX_REG(&jump_uc, REG_RSI) = hargs[1];
                  LX_REG(&jump_uc, REG_RDX) = hargs[2];
  #endif
  
!                 if (syscall(SYS_brand, B_JUMP_TO_LINUX, &jump_uc) == -1) {
!                         lx_err_fatal("B_JUMP_TO_LINUX failed: %s",
!                             strerror(errno));
                  }
-         }
  
          assert(0);
  
  after_signal_handler:
          /*
           * Ensure all nested signal handlers have completed correctly
           * and then remove our stack reservation.
--- 1803,1817 ----
                  LX_REG(&jump_uc, REG_RDI) = hargs[0];
                  LX_REG(&jump_uc, REG_RSI) = hargs[1];
                  LX_REG(&jump_uc, REG_RDX) = hargs[2];
  #endif
  
!                 lx_jump_to_linux(&jump_uc);
          }
  
          assert(0);
+         abort();
  
  after_signal_handler:
          /*
           * Ensure all nested signal handlers have completed correctly
           * and then remove our stack reservation.