Skip to content

Commit 0c49688

Browse files
smaeulpalmer-dabbelt
authored andcommitted
riscv: Fix crash during early errata patching
The patch function for the T-Head PBMT errata calls __pa_symbol() before relocation. This crashes when CONFIG_DEBUG_VIRTUAL is enabled, because __pa_symbol() forwards to __phys_addr_symbol(), and __phys_addr_symbol() checks against the absolute kernel start/end address. Fix this by checking against the kernel map instead of a symbol address. Fixes: a35707c ("riscv: add memory-type errata for T-Head") Reviewed-by: Heiko Stuebner <[email protected]> Tested-by: Heiko Stuebner <[email protected]> Signed-off-by: Samuel Holland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 9abf231 commit 0c49688

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/mm/physaddr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ EXPORT_SYMBOL(__virt_to_phys);
2222
phys_addr_t __phys_addr_symbol(unsigned long x)
2323
{
2424
unsigned long kernel_start = kernel_map.virt_addr;
25-
unsigned long kernel_end = (unsigned long)_end;
25+
unsigned long kernel_end = kernel_start + kernel_map.size;
2626

2727
/*
2828
* Boundary checking aginst the kernel image mapping.

0 commit comments

Comments
 (0)