diff options
author | Jarkko Sakkinen <jarkko.sakkinen@intel.com> | 2012-05-08 14:22:30 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-05-08 14:47:08 -0400 |
commit | f156ffc439951b63cfa9f4d999a8d54267f13282 (patch) | |
tree | b12b7b41f7fef18eb9ead4ed4419b5ab6fb14900 | |
parent | c9b77ccb52a5c77233b0e557b7d4417b00ef4012 (diff) |
x86, realmode: Set permission for real mode pages
Set proper permissions for rodata, text and data, removing the
realmode trampoline area as a remaining RWX memory mapping in the
kernel.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com>
Link: http://lkml.kernel.org/r/1336501366-28617-8-git-send-email-jarkko.sakkinen@intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/kernel/realmode.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/x86/kernel/realmode.c b/arch/x86/kernel/realmode.c index a465775b32f2..d85ac20bb4eb 100644 --- a/arch/x86/kernel/realmode.c +++ b/arch/x86/kernel/realmode.c | |||
@@ -86,7 +86,21 @@ static int __init set_real_mode_permissions(void) | |||
86 | PAGE_ALIGN(real_mode_header.end) - | 86 | PAGE_ALIGN(real_mode_header.end) - |
87 | __pa(real_mode_base); | 87 | __pa(real_mode_base); |
88 | 88 | ||
89 | set_memory_x((unsigned long) real_mode_base, all_size >> PAGE_SHIFT); | 89 | size_t ro_size = |
90 | PAGE_ALIGN(real_mode_header.ro_end) - | ||
91 | __pa(real_mode_base); | ||
92 | |||
93 | size_t text_size = | ||
94 | PAGE_ALIGN(real_mode_header.ro_end) - | ||
95 | real_mode_header.text_start; | ||
96 | |||
97 | unsigned long text_start = | ||
98 | (unsigned long) __va(real_mode_header.text_start); | ||
99 | |||
100 | set_memory_nx((unsigned long) real_mode_base, all_size >> PAGE_SHIFT); | ||
101 | set_memory_ro((unsigned long) real_mode_base, ro_size >> PAGE_SHIFT); | ||
102 | set_memory_x((unsigned long) text_start, text_size >> PAGE_SHIFT); | ||
103 | |||
90 | return 0; | 104 | return 0; |
91 | } | 105 | } |
92 | 106 | ||