summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/pageattr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 968f51a2e39b..a7324045d87d 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -298,9 +298,11 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
298 298
299 /* 299 /*
300 * The .rodata section needs to be read-only. Using the pfn 300 * The .rodata section needs to be read-only. Using the pfn
301 * catches all aliases. 301 * catches all aliases. This also includes __ro_after_init,
302 * so do not enforce until kernel_set_to_readonly is true.
302 */ 303 */
303 if (within(pfn, __pa_symbol(__start_rodata) >> PAGE_SHIFT, 304 if (kernel_set_to_readonly &&
305 within(pfn, __pa_symbol(__start_rodata) >> PAGE_SHIFT,
304 __pa_symbol(__end_rodata) >> PAGE_SHIFT)) 306 __pa_symbol(__end_rodata) >> PAGE_SHIFT))
305 pgprot_val(forbidden) |= _PAGE_RW; 307 pgprot_val(forbidden) |= _PAGE_RW;
306 308