Commit 4e3319c2 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/mm: Fix conditions to perform MMU specific management by blocks on PPC32.

Setting init mem to NX shall depend on sinittext being mapped by
block, not on stext being mapped by block.

Setting text and rodata to RO shall depend on stext being mapped by
block, not on sinittext being mapped by block.

Fixes: 63b2bc61 ("powerpc/mm/32s: Use BATs for STRICT_KERNEL_RWX")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7d565fb8f51b18a3d98445a830b2f6548cb2da2a.1589866984.git.christophe.leroy@csgroup.eu
parent 925ac141
...@@ -185,7 +185,7 @@ void mark_initmem_nx(void) ...@@ -185,7 +185,7 @@ void mark_initmem_nx(void)
unsigned long numpages = PFN_UP((unsigned long)_einittext) - unsigned long numpages = PFN_UP((unsigned long)_einittext) -
PFN_DOWN((unsigned long)_sinittext); PFN_DOWN((unsigned long)_sinittext);
if (v_block_mapped((unsigned long)_stext + 1)) if (v_block_mapped((unsigned long)_sinittext))
mmu_mark_initmem_nx(); mmu_mark_initmem_nx();
else else
change_page_attr(page, numpages, PAGE_KERNEL); change_page_attr(page, numpages, PAGE_KERNEL);
...@@ -197,7 +197,7 @@ void mark_rodata_ro(void) ...@@ -197,7 +197,7 @@ void mark_rodata_ro(void)
struct page *page; struct page *page;
unsigned long numpages; unsigned long numpages;
if (v_block_mapped((unsigned long)_sinittext)) { if (v_block_mapped((unsigned long)_stext + 1)) {
mmu_mark_rodata_ro(); mmu_mark_rodata_ro();
ptdump_check_wx(); ptdump_check_wx();
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment