Skip to content

Commit 295454e

Browse files
BenjaminGrayNp1mpe
authored andcommitted
powerpc64/kasan: Pass virtual addresses to kasan_init_phys_region()
The kasan_init_phys_region() function maps shadow pages necessary for the ranges of the linear map backed by physical pages. Currently kasan_init_phys_region() is being passed physical addresses, but kasan_mem_to_shadow() expects virtual addresses. It works right now because the lower bits (12:64) of the kasan_mem_to_shadow() calculation are the same for the real and virtual addresses, so the actual PTE value is the same in the end. But virtual addresses are the intended input, so fix it. Signed-off-by: Benjamin Gray <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent ad67971 commit 295454e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/powerpc/mm/kasan/init_book3e_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void __init kasan_init(void)
112112
pte_t zero_pte = pfn_pte(virt_to_pfn(kasan_early_shadow_page), PAGE_KERNEL_RO);
113113

114114
for_each_mem_range(i, &start, &end)
115-
kasan_init_phys_region((void *)start, (void *)end);
115+
kasan_init_phys_region(phys_to_virt(start), phys_to_virt(end));
116116

117117
if (IS_ENABLED(CONFIG_KASAN_VMALLOC))
118118
kasan_remove_zero_shadow((void *)VMALLOC_START, VMALLOC_SIZE);

arch/powerpc/mm/kasan/init_book3s_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void __init kasan_init(void)
6262
}
6363

6464
for_each_mem_range(i, &start, &end)
65-
kasan_init_phys_region((void *)start, (void *)end);
65+
kasan_init_phys_region(phys_to_virt(start), phys_to_virt(end));
6666

6767
for (i = 0; i < PTRS_PER_PTE; i++)
6868
__set_pte_at(&init_mm, (unsigned long)kasan_early_shadow_page,

0 commit comments

Comments
 (0)