aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2009-10-28 22:46:58 -0400
committerIngo Molnar <mingo@elte.hu>2009-11-02 11:17:24 -0500
commite7d23dde9b7ebb575e2bcee2abefc9ec1e4adde9 (patch)
treee3c8683d149e29a2d3a6099ddcae4732d17d6b31 /arch/x86/mm
parent55ca3cc1746335bb6ef1d3894ddb6d0c729b3518 (diff)
x86_64, cpa: Use only text section in set_kernel_text_rw/ro
set_kernel_text_rw()/set_kernel_text_ro() are marking pages starting from _text to __start_rodata as RW or RO. With CONFIG_DEBUG_RODATA, there might be free pages (associated with padding the sections to 2MB large page boundary) between text and rodata sections that are given back to page allocator. So we should use only use the start (__text) and end (__stop___ex_table) of the text section in set_kernel_text_rw()/set_kernel_text_ro(). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Tested-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <20091029024821.164525222@sbs-t61.sc.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 4b507c08940..5198b9bb34e 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