diff options
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index a25cc6fa2207..27de2435e008 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -991,6 +991,13 @@ EXPORT_SYMBOL_GPL(rodata_test_data); | |||
991 | void mark_rodata_ro(void) | 991 | void mark_rodata_ro(void) |
992 | { | 992 | { |
993 | unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata); | 993 | unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata); |
994 | unsigned long rodata_start = | ||
995 | ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; | ||
996 | |||
997 | #ifdef CONFIG_DYNAMIC_FTRACE | ||
998 | /* Dynamic tracing modifies the kernel text section */ | ||
999 | start = rodata_start; | ||
1000 | #endif | ||
994 | 1001 | ||
995 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", | 1002 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", |
996 | (end - start) >> 10); | 1003 | (end - start) >> 10); |
@@ -1000,8 +1007,7 @@ void mark_rodata_ro(void) | |||
1000 | * The rodata section (but not the kernel text!) should also be | 1007 | * The rodata section (but not the kernel text!) should also be |
1001 | * not-executable. | 1008 | * not-executable. |
1002 | */ | 1009 | */ |
1003 | start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; | 1010 | set_memory_nx(rodata_start, (end - rodata_start) >> PAGE_SHIFT); |
1004 | set_memory_nx(start, (end - start) >> PAGE_SHIFT); | ||
1005 | 1011 | ||
1006 | rodata_test(); | 1012 | rodata_test(); |
1007 | 1013 | ||