Print this page
OS-5576 harden random pool for zones
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>

@@ -18,10 +18,12 @@
  *
  * CDDL HEADER END
  *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright 2016 Joyent, Inc.
  */
 
 
 /*
  * Random number generator pseudo-driver

@@ -287,10 +289,13 @@
                 /* See comments in rnd_read() */
                 uiop->uio_loffset = 0;
                 if ((error = uiomove(buf, bytes, UIO_WRITE, uiop)) != 0)
                         return (error);
 
+                if (crgetzone(credp) != global_zone)
+                        continue;
+
                 switch (devno) {
                 case DEVRANDOM:
                         if ((error = random_add_entropy(buf, bytes, 0)) != 0)
                                 return (error);
                         break;