mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: initialize jump labels before setup_machine_fdt()
@ 2022-06-02 21:22 Jason A. Donenfeld
  2022-06-03  6:53 ` Ard Biesheuvel
  0 siblings, 1 reply; 8+ messages in thread
From: Jason A. Donenfeld @ 2022-06-02 21:22 UTC (permalink / raw)
  To: linux, rmk+kernel, linux-arm-kernel, linux-kernel, catalin.marinas
  Cc: Jason A. Donenfeld, Stephen Boyd, Ard Biesheuvel, stable

Stephen reported that a static key warning splat appears during early
boot on arm64 systems that credit randomness from device trees that
contain an "rng-seed" property, because setup_machine_fdt() is called
before jump_label_init() during setup_arch(), which was fixed by
73e2d827a501 ("arm64: Initialize jump labels before
setup_machine_fdt()").

Upon cursory inspection, the same basic issue appears to apply to arm32
as well. In this case, we reorder setup_arch() to do things in the same
order as is now the case on arm64.

Reported-by: Stephen Boyd <swboyd@chromium.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: stable@vger.kernel.org
Fixes: f5bda35fba61 ("random: use static branch for crng_ready()")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/arm/kernel/setup.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1e8a50a97edf..ef40d9f5d5a7 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1097,10 +1097,15 @@ void __init setup_arch(char **cmdline_p)
 	const struct machine_desc *mdesc = NULL;
 	void *atags_vaddr = NULL;
 
+	setup_initial_init_mm(_text, _etext, _edata, _end);
+	setup_processor();
+	early_fixmap_init();
+	early_ioremap_init();
+	jump_label_init();
+
 	if (__atags_pointer)
 		atags_vaddr = FDT_VIRT_BASE(__atags_pointer);
 
-	setup_processor();
 	if (atags_vaddr) {
 		mdesc = setup_machine_fdt(atags_vaddr);
 		if (mdesc)
@@ -1125,15 +1130,10 @@ void __init setup_arch(char **cmdline_p)
 	if (mdesc->reboot_mode != REBOOT_HARD)
 		reboot_mode = mdesc->reboot_mode;
 
-	setup_initial_init_mm(_text, _etext, _edata, _end);
-
 	/* populate cmd_line too for later use, preserving boot_command_line */
 	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = cmd_line;
 
-	early_fixmap_init();
-	early_ioremap_init();
-
 	parse_early_param();
 
 #ifdef CONFIG_MMU
-- 
2.35.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-03  8:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 21:22 [PATCH] ARM: initialize jump labels before setup_machine_fdt() Jason A. Donenfeld
2022-06-03  6:53 ` Ard Biesheuvel
2022-06-03  7:37   ` Jason A. Donenfeld
2022-06-03  7:51     ` Ard Biesheuvel
2022-06-03  8:06       ` Ard Biesheuvel
2022-06-03  8:14         ` Jason A. Donenfeld
2022-06-03  8:12       ` Jason A. Donenfeld
2022-06-03  8:17         ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®