Skip to content

Commit 401e844

Browse files
Alexandre Ghitipalmer-dabbelt
authored andcommitted
riscv: Move DTB_EARLY_BASE_VA to the kernel address space
The early virtual address should lie in the kernel address space for inline kasan instrumentation to succeed, otherwise kasan tries to dereference an address that does not exist in the address space (since kasan only maps *kernel* address space, not the userspace). Simply use the very first address of the kernel address space for the early fdt mapping. It allowed an Ubuntu kernel to boot successfully with inline instrumentation. Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Link: https://lore.kernel.org/r/20230203075232.274282-4-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 96f9d4d commit 401e844

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/riscv/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
5757
EXPORT_SYMBOL(empty_zero_page);
5858

5959
extern char _start[];
60-
#define DTB_EARLY_BASE_VA PGDIR_SIZE
60+
#define DTB_EARLY_BASE_VA (ADDRESS_SPACE_END - (PTRS_PER_PGD / 2 * PGDIR_SIZE) + 1)
6161
void *_dtb_early_va __initdata;
6262
uintptr_t _dtb_early_pa __initdata;
6363

0 commit comments

Comments
 (0)