Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpkern Initialize the kern_cprng in rump ...



details:   https://anonhg.NetBSD.org/src/rev/213e227351f1
branches:  trunk
changeset: 771724:213e227351f1
user:      tls <tls%NetBSD.org@localhost>
date:      Thu Dec 01 19:15:15 2011 +0000

description:
Initialize the kern_cprng in rump startup.  Oops.

Should fix some "mysterious" rump test failures.  Thanks to Nicholas Joly
for pointing out exactly what was wrong.

diffstat:

 sys/rump/librump/rumpkern/rump.c |  26 ++++++--------------------
 1 files changed, 6 insertions(+), 20 deletions(-)

diffs (55 lines):

diff -r 1d79b6d9a89b -r 213e227351f1 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Thu Dec 01 14:18:02 2011 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Thu Dec 01 19:15:15 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.236 2011/11/26 21:41:02 njoly Exp $ */
+/*     $NetBSD: rump.c,v 1.237 2011/12/01 19:15:15 tls Exp $   */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.236 2011/11/26 21:41:02 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.237 2011/12/01 19:15:15 tls Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -163,19 +163,6 @@
 
 static void add_linkedin_modules(const struct modinfo *const *, size_t);
 
-static void __noinline
-messthestack(void)
-{
-       volatile uint32_t mess[64];
-       uint64_t d1, d2;
-       int i, error;
-
-       for (i = 0; i < 64; i++) {
-               rumpuser_gettime(&d1, &d2, &error);
-               mess[i] = d2;
-       }
-}
-
 /*
  * Create kern.hostname.  why only this you ask.  well, init_sysctl
  * is a kitchen sink in need of some gardening.  but i want to use
@@ -328,12 +315,11 @@
        kauth_init();
 
        /*
-        * Seed arc4random() with a "reasonable" amount of randomness.
-        * Yes, this is a quick kludge which depends on the arc4random
-        * implementation.
+        * Create the kernel cprng.  Yes, it's currently stubbed out
+        * to arc4random() for RUMP, but this won't always be so.
         */
-       messthestack();
-       cprng_fast32();
+       kern_cprng = cprng_strong_create("kernel", IPL_VM,
+                                        CPRNG_INIT_ANY|CPRNG_REKEY_ANY);
 
        procinit();
        proc0_init();



Home | Main Index | Thread Index | Old Index