diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-02-06 22:39:45 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-02-06 22:39:45 +0100 |
commit | 984bb80d94d891592ab16d4d129b988792752c7b (patch) | |
tree | efc22a5eb3e3cf05b056bedcbe48bbdb48b99ad8 /arch/x86/mm/init_64.c | |
parent | a57dae3aa4d00a000b5bac4238025438204c78b2 (diff) |
x86: mark the .rodata section also NX
The .rodata section shouldn't just be read-only,
but also non-executable. This is free since we've broken
up the 2MB page already anyway.
also update test_nx to check for this.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 3a98d6f724a..9b61c75a235 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -591,10 +591,17 @@ void mark_rodata_ro(void) if (end <= start) return; - set_memory_ro(start, (end - start) >> PAGE_SHIFT); printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", (end - start) >> 10); + set_memory_ro(start, (end - start) >> PAGE_SHIFT); + + /* + * The rodata section (but not the kernel text!) should also be + * not-executable. + */ + start = ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; + set_memory_nx(start, (end - start) >> PAGE_SHIFT); rodata_test(); |