Print this page

        

@@ -23,11 +23,11 @@
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*
- * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ * Copyright 2015, Joyent, Inc.
  * Copyright 2023 Oxide Computer Company
  */
 
 #include <sys/types.h>
 #include <sys/uio.h>

@@ -1610,11 +1610,11 @@
                         /* Set signaled sleeping/waiting lwp running */
                         setrun_locked(t);
                 } else if (t->t_state == TS_STOPPED && sig == SIGKILL) {
                         /* If SIGKILL, set stopped lwp running */
                         p->p_stopsig = 0;
-                        t->t_schedflag |= TS_XSTART | TS_PSTART;
+                        t->t_schedflag |= TS_XSTART | TS_PSTART | TS_BSTART;
                         t->t_dtrace_stop = 0;
                         setrun_locked(t);
                 }
                 t->t_sig_check = 1;     /* so ISSIG will be done */
                 thread_unlock(t);

@@ -2384,13 +2384,21 @@
 
         if (secpolicy_zone_config(cr) != 0)
                 return (EPERM);
         if (zoneid != GLOBAL_ZONEID && zoneid != p->p_zone->zone_id)
                 return (EINVAL);
-        if ((zptr = zone_find_by_id(zoneid)) == NULL)
-                return (EINVAL);
+        /*
+         * We cannot hold p_lock when we call zone_find_by_id since that can
+         * lead to a deadlock. zone_find_by_id() takes zonehash_lock.
+         * zone_enter() can hold the zonehash_lock and needs p_lock when it
+         * calls task_join.
+         */
         mutex_exit(&p->p_lock);
+        if ((zptr = zone_find_by_id(zoneid)) == NULL) {
+                mutex_enter(&p->p_lock);
+                return (EINVAL);
+        }
         mutex_enter(&p->p_crlock);
         oldcred = p->p_cred;
         crhold(oldcred);
         mutex_exit(&p->p_crlock);
         newcred = crdup(oldcred);