mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
powerpc/32s: map kasan zero shadow with PAGE_READONLY instead of PAGE_KERNEL_RO
For hash32, the zero shadow page gets mapped with PAGE_READONLY instead of PAGE_KERNEL_RO, because the PP bits don't provide a RO kernel, so PAGE_KERNEL_RO is equivalent to PAGE_KERNEL. By using PAGE_READONLY, the page is RO for both kernel and user, but this is not a security issue as it contains only zeroes. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
215b823707
commit
da3a3b0a0e
1 changed files with 8 additions and 2 deletions
|
@ -39,6 +39,9 @@ static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_
|
|||
|
||||
if (!new)
|
||||
return -ENOMEM;
|
||||
if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
|
||||
kasan_populate_pte(new, PAGE_READONLY);
|
||||
else
|
||||
kasan_populate_pte(new, PAGE_KERNEL_RO);
|
||||
pmd_populate_kernel(&init_mm, pmd, new);
|
||||
}
|
||||
|
@ -84,6 +87,9 @@ static int __ref kasan_init_region(void *start, size_t size)
|
|||
|
||||
static void __init kasan_remap_early_shadow_ro(void)
|
||||
{
|
||||
if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
|
||||
kasan_populate_pte(kasan_early_shadow_pte, PAGE_READONLY);
|
||||
else
|
||||
kasan_populate_pte(kasan_early_shadow_pte, PAGE_KERNEL_RO);
|
||||
|
||||
flush_tlb_kernel_range(KASAN_SHADOW_START, KASAN_SHADOW_END);
|
||||
|
|
Loading…
Reference in a new issue