[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220623164349.074537039@linuxfoundation.org>
Date: Thu, 23 Jun 2022 18:42:50 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
Stafford Horne <shorne@...il.com>,
"Jason A. Donenfeld" <Jason@...c4.com>
Subject: [PATCH 4.9 177/264] init: call time_init() before rand_initialize()
From: "Jason A. Donenfeld" <Jason@...c4.com>
commit fe222a6ca2d53c38433cba5d3be62a39099e708e upstream.
Currently time_init() is called after rand_initialize(), but
rand_initialize() makes use of the timer on various platforms, and
sometimes this timer needs to be initialized by time_init() first. In
order for random_get_entropy() to not return zero during early boot when
it's potentially used as an entropy source, reverse the order of these
two calls. The block doing random initialization was right before
time_init() before, so changing the order shouldn't have any complicated
effects.
Cc: Andrew Morton <akpm@...ux-foundation.org>
Reviewed-by: Stafford Horne <shorne@...il.com>
Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
init/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/init/main.c
+++ b/init/main.c
@@ -578,11 +578,13 @@ asmlinkage __visible void __init start_k
hrtimers_init();
softirq_init();
timekeeping_init();
+ time_init();
/*
* For best initial stack canary entropy, prepare it after:
* - setup_arch() for any UEFI RNG entropy and boot cmdline access
* - timekeeping_init() for ktime entropy used in rand_initialize()
+ * - time_init() for making random_get_entropy() work on some platforms
* - rand_initialize() to get any arch-specific entropy like RDRAND
* - add_latent_entropy() to get any latent entropy
* - adding command line entropy
@@ -592,7 +594,6 @@ asmlinkage __visible void __init start_k
add_device_randomness(command_line, strlen(command_line));
boot_init_stack_canary();
- time_init();
sched_clock_postinit();
printk_nmi_init();
perf_event_init();
Powered by blists - more mailing lists