Skip to content

Commit 31e833b

Browse files
guilhermepiccolictmarinas
authored andcommitted
arm64: Unhash early pointer print plus improve comment
When facing a really early issue on DT parsing we have currently a message that shows both the physical and virtual address of the FDT. The printk pointer modifier for the virtual address shows a hashed address there unless the user provides "no_hash_pointers" parameter in the command-line. The situation in which this message shows-up is a bit more serious though: the boot process is broken, nothing can be done (even an oops is too much for this early stage) so we have this message as a last resort in order to help debug bootloader issues, for example. Hence, we hereby change that to "%px" in order to make debugging easy, there's not much information leak risk in such early boot failure. Also, we tried to improve a bit the commenting on that function, given that if kernel fails there, it just hangs forever in a cpu_relax() loop. The reason we cannot BUG/panic is that is too early to do so; thanks to Mark Brown for pointing that on IRC and thanks Robin Murphy for the good pointer hash discussion in the mailing-list. Cc: Mark Brown <[email protected]> Cc: Robin Murphy <[email protected]> Signed-off-by: Guilherme G. Piccoli <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent d5624bb commit 31e833b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm64/kernel/setup.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,16 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
189189

190190
if (!dt_virt || !early_init_dt_scan(dt_virt)) {
191191
pr_crit("\n"
192-
"Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n"
192+
"Error: invalid device tree blob at physical address %pa (virtual address 0x%px)\n"
193193
"The dtb must be 8-byte aligned and must not exceed 2 MB in size\n"
194194
"\nPlease check your bootloader.",
195195
&dt_phys, dt_virt);
196196

197+
/*
198+
* Note that in this _really_ early stage we cannot even BUG()
199+
* or oops, so the least terrible thing to do is cpu_relax(),
200+
* or else we could end-up printing non-initialized data, etc.
201+
*/
197202
while (true)
198203
cpu_relax();
199204
}

0 commit comments

Comments
 (0)