diff options
author | Jan Beulich <jbeulich@novell.com> | 2007-05-02 13:27:10 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:10 -0400 |
commit | 6fb14755a676282a4e6caa05a08c92db8e45cfff (patch) | |
tree | 71a862edf87cafe61986c0aff90db72045cf14c3 /arch/x86_64/kernel | |
parent | d01ad8dd56527be72947b4b9997bb2c05783c3ed (diff) |
[PATCH] x86: tighten kernel image page access rights
On x86-64, kernel memory freed after init can be entirely unmapped instead
of just getting 'poisoned' by overwriting with a debug pattern.
On i386 and x86-64 (under CONFIG_DEBUG_RODATA), kernel text and bug table
can also be write-protected.
Compared to the first version, this one prevents re-creating deleted
mappings in the kernel image range on x86-64, if those got removed
previously. This, together with the original changes, prevents temporarily
having inconsistent mappings when cacheability attributes are being
changed on such pages (e.g. from AGP code). While on i386 such duplicate
mappings don't exist, the same change is done there, too, both for
consistency and because checking pte_present() before using various other
pte_XXX functions is a requirement anyway. At once, i386 code gets
adjusted to use pte_huge() instead of open coding this.
AK: split out cpa() changes
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r-- | arch/x86_64/kernel/head.S | 1 | ||||
-rw-r--r-- | arch/x86_64/kernel/vmlinux.lds.S | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S index 36aa98a6d15c..fd9fdfdd143e 100644 --- a/arch/x86_64/kernel/head.S +++ b/arch/x86_64/kernel/head.S | |||
@@ -280,7 +280,6 @@ early_idt_ripmsg: | |||
280 | 280 | ||
281 | .balign PAGE_SIZE | 281 | .balign PAGE_SIZE |
282 | ENTRY(stext) | 282 | ENTRY(stext) |
283 | ENTRY(_stext) | ||
284 | 283 | ||
285 | #define NEXT_PAGE(name) \ | 284 | #define NEXT_PAGE(name) \ |
286 | .balign PAGE_SIZE; \ | 285 | .balign PAGE_SIZE; \ |
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index 5176ecf006ee..3bdeb88d28f4 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S | |||
@@ -29,6 +29,7 @@ SECTIONS | |||
29 | .text : AT(ADDR(.text) - LOAD_OFFSET) { | 29 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
30 | /* First the code that has to be first for bootstrapping */ | 30 | /* First the code that has to be first for bootstrapping */ |
31 | *(.bootstrap.text) | 31 | *(.bootstrap.text) |
32 | _stext = .; | ||
32 | /* Then all the functions that are "hot" in profiles, to group them | 33 | /* Then all the functions that are "hot" in profiles, to group them |
33 | onto the same hugetlb entry */ | 34 | onto the same hugetlb entry */ |
34 | #include "functionlist" | 35 | #include "functionlist" |
@@ -50,10 +51,10 @@ SECTIONS | |||
50 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } | 51 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } |
51 | __stop___ex_table = .; | 52 | __stop___ex_table = .; |
52 | 53 | ||
53 | RODATA | ||
54 | |||
55 | BUG_TABLE | 54 | BUG_TABLE |
56 | 55 | ||
56 | RODATA | ||
57 | |||
57 | . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ | 58 | . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ |
58 | /* Data */ | 59 | /* Data */ |
59 | .data : AT(ADDR(.data) - LOAD_OFFSET) { | 60 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |