Print this page
OS-3561 lxbrand emulation library should execute on alternate stack
OS-3558 lxbrand add support for full in-kernel syscall handling
OS-3545 lx_syscall_regs should not walk stack
OS-3868 many LTP testcases now hang
OS-3901 lxbrand lx_recvmsg fails to translate control messages when 64-bit
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
        
@@ -18,10 +18,13 @@
  *
  * CDDL HEADER END
  */
 
 /*
+ * Copyright 2015 Joyent, Inc.
+ */
+/*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -108,14 +111,19 @@
         getfpasrs(lwp, ucp->uc_mcontext.asrs);
         if (ucp->uc_mcontext.fpregs.fpu_en == 0)
                 ucp->uc_flags &= ~UC_FPU;
         ucp->uc_mcontext.gwins = (gwindows_t *)NULL;
 
+        if (mask != NULL) {
         /*
          * Save signal mask.
          */
         sigktou(mask, &ucp->uc_sigmask);
+        } else {
+                ucp->uc_flags &= ~UC_SIGMASK;
+                bzero(&ucp->uc_sigmask, sizeof (ucp->uc_sigmask));
+        }
 }
 
 
 void
 restorecontext(ucontext_t *ucp)
@@ -410,15 +418,20 @@
 
         if (ucp->uc_mcontext.fpregs.fpu_en == 0)
                 ucp->uc_flags &= ~UC_FPU;
         ucp->uc_mcontext.gwins = (caddr32_t)NULL;
 
+        if (mask != NULL) {
         /*
          * Save signal mask (the 32- and 64-bit sigset_t structures are
          * identical).
          */
         sigktou(mask, (sigset_t *)&ucp->uc_sigmask);
+        } else {
+                ucp->uc_flags &= ~UC_SIGMASK;
+                bzero(&ucp->uc_sigmask, sizeof (ucp->uc_sigmask));
+        }
 }
 
 int
 getsetcontext32(int flag, void *arg)
 {