aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r--arch/x86/mm/init_64.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 819dad973b13..17c0a6138a53 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -767,6 +767,13 @@ EXPORT_SYMBOL_GPL(rodata_test_data);
767void mark_rodata_ro(void) 767void mark_rodata_ro(void)
768{ 768{
769 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata); 769 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata);
770 unsigned long rodata_start =
771 ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK;
772
773#ifdef CONFIG_DYNAMIC_FTRACE
774 /* Dynamic tracing modifies the kernel text section */
775 start = rodata_start;
776#endif
770 777
771 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 778 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
772 (end - start) >> 10); 779 (end - start) >> 10);
@@ -776,8 +783,7 @@ void mark_rodata_ro(void)
776 * The rodata section (but not the kernel text!) should also be 783 * The rodata section (but not the kernel text!) should also be
777 * not-executable. 784 * not-executable.
778 */ 785 */
779 start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; 786 set_memory_nx(rodata_start, (end - rodata_start) >> PAGE_SHIFT);
780 set_memory_nx(start, (end - start) >> PAGE_SHIFT);
781 787
782 rodata_test(); 788 rodata_test();
783 789