[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220508002018.117030-1-Jason@zx2c4.com>
Date: Sun, 8 May 2022 02:20:18 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: linux-kernel@...r.kernel.org
Cc: "Jason A. Donenfeld" <Jason@...c4.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Stafford Horne <shorne@...il.com>
Subject: [PATCH v2] init: call time_init() before rand_initialize()
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>
Cc: Stafford Horne <shorne@...il.com>
Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
---
Changes v1->v2:
- Clarified commit message; code remains the same.
This lives in random.git and will be in linux-next for testing.
init/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 98182c3c2c4b..e37ec99cf56d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1035,6 +1035,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
softirq_init();
timekeeping_init();
kfence_init();
+ time_init();
/*
* For best initial stack canary entropy, prepare it after:
@@ -1049,7 +1050,6 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
add_device_randomness(command_line, strlen(command_line));
boot_init_stack_canary();
- time_init();
perf_event_init();
profile_init();
call_function_init();
--
2.35.1
Powered by blists - more mailing lists