aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init_64.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 4b507c089402..5198b9bb34ef 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -700,7 +700,7 @@ int kernel_set_to_readonly;
700void set_kernel_text_rw(void) 700void set_kernel_text_rw(void)
701{ 701{
702 unsigned long start = PFN_ALIGN(_text); 702 unsigned long start = PFN_ALIGN(_text);
703 unsigned long end = PFN_ALIGN(__start_rodata); 703 unsigned long end = PFN_ALIGN(__stop___ex_table);
704 704
705 if (!kernel_set_to_readonly) 705 if (!kernel_set_to_readonly)
706 return; 706 return;
@@ -708,13 +708,18 @@ void set_kernel_text_rw(void)
708 pr_debug("Set kernel text: %lx - %lx for read write\n", 708 pr_debug("Set kernel text: %lx - %lx for read write\n",
709 start, end); 709 start, end);
710 710
711 /*
712 * Make the kernel identity mapping for text RW. Kernel text
713 * mapping will always be RO. Refer to the comment in
714 * static_protections() in pageattr.c
715 */
711 set_memory_rw(start, (end - start) >> PAGE_SHIFT); 716 set_memory_rw(start, (end - start) >> PAGE_SHIFT);
712} 717}
713 718
714void set_kernel_text_ro(void) 719void set_kernel_text_ro(void)
715{ 720{
716 unsigned long start = PFN_ALIGN(_text); 721 unsigned long start = PFN_ALIGN(_text);
717 unsigned long end = PFN_ALIGN(__start_rodata); 722 unsigned long end = PFN_ALIGN(__stop___ex_table);
718 723
719 if (!kernel_set_to_readonly) 724 if (!kernel_set_to_readonly)
720 return; 725 return;
@@ -722,6 +727,9 @@ void set_kernel_text_ro(void)
722 pr_debug("Set kernel text: %lx - %lx for read only\n", 727 pr_debug("Set kernel text: %lx - %lx for read only\n",
723 start, end); 728 start, end);
724 729
730 /*
731 * Set the kernel identity mapping for text RO.
732 */
725 set_memory_ro(start, (end - start) >> PAGE_SHIFT); 733 set_memory_ro(start, (end - start) >> PAGE_SHIFT);
726} 734}
727 735