summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2013-12-28 03:04:20 +0000
committerderaadt <deraadt@openbsd.org>2013-12-28 03:04:20 +0000
commitd21f8b83a997c59075bf068d03283314fb27a093 (patch)
treec8ae404e6f526bbb5d5b075707f2ae62829cf151 /sys
parentPut the entropy_pool[] into the ELF .openbsd.randomdata segment. (diff)
downloadwireguard-openbsd-d21f8b83a997c59075bf068d03283314fb27a093.tar.xz
wireguard-openbsd-d21f8b83a997c59075bf068d03283314fb27a093.zip
We can random_start() earlier (not that it does too much) and call
arc4random() much earlier. Leading to random pids for anything besides 0 and 1.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/init_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 2e8cade491a..eb6415b145f 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.192 2013/12/01 16:40:56 krw Exp $ */
+/* $OpenBSD: init_main.c,v 1.193 2013/12/28 03:04:20 deraadt Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -340,6 +340,9 @@ main(void *framep)
sleep_queue_init();
sched_init_cpu(curcpu());
+ random_start();
+ srandom(arc4random());
+
/* Initialize work queues */
workq_init();
taskq_init();
@@ -447,6 +450,8 @@ main(void *framep)
&initproc))
panic("fork init");
+ randompid = 1;
+
/*
* Create any kernel threads whose creation was deferred because
* initproc had not yet been created.
@@ -533,8 +538,6 @@ main(void *framep)
microtime(&rtv);
srandom((u_int32_t)(rtv.tv_sec ^ rtv.tv_usec) ^ arc4random());
- randompid = 1;
-
#if defined(MULTIPROCESSOR)
/* Boot the secondary processors. */
cpu_boot_secondary_processors();