aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init_32.c24
-rw-r--r--arch/x86/mm/init_64.c20
2 files changed, 10 insertions, 34 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index ee1091a46964..00168e65688a 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -723,25 +723,17 @@ void mark_rodata_ro(void)
723 unsigned long start = PFN_ALIGN(_text); 723 unsigned long start = PFN_ALIGN(_text);
724 unsigned long size = PFN_ALIGN(_etext) - start; 724 unsigned long size = PFN_ALIGN(_etext) - start;
725 725
726#ifndef CONFIG_KPROBES 726 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
727#ifdef CONFIG_HOTPLUG_CPU 727 printk(KERN_INFO "Write protecting the kernel text: %luk\n",
728 /* It must still be possible to apply SMP alternatives. */ 728 size >> 10);
729 if (num_possible_cpus() <= 1)
730#endif
731 {
732 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
733 printk(KERN_INFO "Write protecting the kernel text: %luk\n",
734 size >> 10);
735 729
736#ifdef CONFIG_CPA_DEBUG 730#ifdef CONFIG_CPA_DEBUG
737 printk(KERN_INFO "Testing CPA: Reverting %lx-%lx\n", 731 printk(KERN_INFO "Testing CPA: Reverting %lx-%lx\n",
738 start, start+size); 732 start, start+size);
739 set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT); 733 set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT);
740 734
741 printk(KERN_INFO "Testing CPA: write protecting again\n"); 735 printk(KERN_INFO "Testing CPA: write protecting again\n");
742 set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT); 736 set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
743#endif
744 }
745#endif 737#endif
746 start += size; 738 start += size;
747 size = (unsigned long)__end_rodata - start; 739 size = (unsigned long)__end_rodata - start;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ae66d8d4c58d..4cb6c7f80f07 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -635,24 +635,7 @@ EXPORT_SYMBOL_GPL(rodata_test_data);
635 635
636void mark_rodata_ro(void) 636void mark_rodata_ro(void)
637{ 637{
638 unsigned long start = (unsigned long)_stext, end; 638 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata);
639
640#ifdef CONFIG_HOTPLUG_CPU
641 /* It must still be possible to apply SMP alternatives. */
642 if (num_possible_cpus() > 1)
643 start = (unsigned long)_etext;
644#endif
645
646#ifdef CONFIG_KPROBES
647 start = (unsigned long)__start_rodata;
648#endif
649
650 end = (unsigned long)__end_rodata;
651 start = (start + PAGE_SIZE - 1) & PAGE_MASK;
652 end &= PAGE_MASK;
653 if (end <= start)
654 return;
655
656 639
657 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 640 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
658 (end - start) >> 10); 641 (end - start) >> 10);
@@ -675,6 +658,7 @@ void mark_rodata_ro(void)
675 set_memory_ro(start, (end-start) >> PAGE_SHIFT); 658 set_memory_ro(start, (end-start) >> PAGE_SHIFT);
676#endif 659#endif
677} 660}
661
678#endif 662#endif
679 663
680#ifdef CONFIG_BLK_DEV_INITRD 664#ifdef CONFIG_BLK_DEV_INITRD