summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pgtable_32.c
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2022-09-16 06:07:49 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2022-09-26 12:58:16 +0200
commit7082f8e7d2276575a8806370007cbb4a7b9abdce (patch)
tree8b534ee44f283a58de7353121e364a7f9e524747 /arch/powerpc/mm/pgtable_32.c
parentpowerpc/vmlinux.lds: Add an explicit symbol for the SRWX boundary (diff)
downloadlinux-7082f8e7d2276575a8806370007cbb4a7b9abdce.tar.xz
linux-7082f8e7d2276575a8806370007cbb4a7b9abdce.zip
powerpc: move __end_rodata to cover arch read-only sections
powerpc has a number of read-only sections and tables that are put after RO_DATA(). Move the __end_rodata symbol to cover these as well. Setting memory to read-only at boot is done using __init_begin, change that to use __end_rodata. This makes is_kernel_rodata() exactly cover the read-only region, as well as other things using __end_rodata (e.g., kernel/dma/debug.c). Boot dmesg also prints the rodata size more accurately. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220916040755.2398112-2-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/mm/pgtable_32.c')
-rw-r--r--arch/powerpc/mm/pgtable_32.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 3ac73f9fb5d5..5c02fd08d61e 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -158,10 +158,11 @@ void mark_rodata_ro(void)
}
/*
- * mark .text and .rodata as read only. Use __init_begin rather than
- * __end_rodata to cover NOTES and EXCEPTION_TABLE.
+ * mark text and rodata as read only. __end_rodata is set by
+ * powerpc's linker script and includes tables and data
+ * requiring relocation which are not put in RO_DATA.
*/
- numpages = PFN_UP((unsigned long)__init_begin) -
+ numpages = PFN_UP((unsigned long)__end_rodata) -
PFN_DOWN((unsigned long)_stext);
set_memory_ro((unsigned long)_stext, numpages);