diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-12-28 03:04:21 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-12-28 03:04:21 +0000 |
commit | c5d97547accee347ad82f9dc95c6933cf458c73a (patch) | |
tree | a2ee0ac060284e54a989c95ea7b7003a87b23f6b /sys/kern/init_main.c | |
parent | 49a7c2607aa04d537633aeaad98dba0869b7ff36 (diff) |
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/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 9 |
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(); |