From: deraadt Date: Fri, 9 Feb 2018 03:01:24 +0000 (+0000) Subject: Situation occur where bootloader cannot supply kernel with early X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=86f75043105d227be7a5ad20a36fccc92455bad3;p=openbsd Situation occur where bootloader cannot supply kernel with early random data. But a new source of entropy arrived a few months ago -- KARL generates highly disturbed images for some kernels (well, not for bsd.rd) This assumes the tail of text (just before etext[]) is readable. We are trying to use a portable symbol name, and also avoid reading a locore0 which has been unmapped... ok mortimer --- diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 48ae1af221e..e33cb5fd7c0 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.197 2018/02/08 10:01:12 mortimer Exp $ */ +/* $OpenBSD: rnd.c,v 1.198 2018/02/09 03:01:24 deraadt Exp $ */ /* * Copyright (c) 2011 Theo de Raadt. @@ -747,6 +747,8 @@ arc4_reinit(void *v) void random_start(void) { + extern char etext[]; + #if !defined(NO_PROPOLICE) extern long __guard_local; @@ -761,6 +763,8 @@ random_start(void) if (msgbufp->msg_magic == MSG_MAGIC) add_entropy_words((u_int32_t *)msgbufp->msg_bufc, msgbufp->msg_bufs / sizeof(u_int32_t)); + add_entropy_words((u_int32_t *)etext - 32*1024, + 8192/sizeof(u_int32_t)); dequeue_randomness(NULL); arc4_init(NULL);