diff options
author | Andi Kleen <ak@suse.de> | 2008-01-30 07:33:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:53 -0500 |
commit | 934d15854d04e8ca2495d8f5698164df990d5d66 (patch) | |
tree | da1e14ba6c88b3862fbd2f8e6a62e6e91622452d | |
parent | 1e8e23bc469a11fc190a6bace857075d83dc2555 (diff) |
x86: remove set_kernel_exec()
The SMP trampoline always runs in real mode, so making it executable
in the page tables doesn't make much sense because it executes
before page tables are set up. That was the only user of
set_kernel_exec(). Remove set_kernel_exec().
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/smpboot_32.c | 11 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 29 | ||||
-rw-r--r-- | include/asm-x86/pgtable_32.h | 12 |
3 files changed, 0 insertions, 52 deletions
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c index 7a62dced61ca..5787a0c3e296 100644 --- a/arch/x86/kernel/smpboot_32.c +++ b/arch/x86/kernel/smpboot_32.c | |||
@@ -107,7 +107,6 @@ u8 apicid_2_node[MAX_APICID]; | |||
107 | extern const unsigned char trampoline_data []; | 107 | extern const unsigned char trampoline_data []; |
108 | extern const unsigned char trampoline_end []; | 108 | extern const unsigned char trampoline_end []; |
109 | static unsigned char *trampoline_base; | 109 | static unsigned char *trampoline_base; |
110 | static int trampoline_exec; | ||
111 | 110 | ||
112 | static void map_cpu_to_logical_apicid(void); | 111 | static void map_cpu_to_logical_apicid(void); |
113 | 112 | ||
@@ -139,10 +138,6 @@ void __init smp_alloc_memory(void) | |||
139 | */ | 138 | */ |
140 | if (__pa(trampoline_base) >= 0x9F000) | 139 | if (__pa(trampoline_base) >= 0x9F000) |
141 | BUG(); | 140 | BUG(); |
142 | /* | ||
143 | * Make the SMP trampoline executable: | ||
144 | */ | ||
145 | trampoline_exec = set_kernel_exec((unsigned long)trampoline_base, 1); | ||
146 | } | 141 | } |
147 | 142 | ||
148 | /* | 143 | /* |
@@ -1290,12 +1285,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus) | |||
1290 | setup_ioapic_dest(); | 1285 | setup_ioapic_dest(); |
1291 | #endif | 1286 | #endif |
1292 | zap_low_mappings(); | 1287 | zap_low_mappings(); |
1293 | #ifndef CONFIG_HOTPLUG_CPU | ||
1294 | /* | ||
1295 | * Disable executability of the SMP trampoline: | ||
1296 | */ | ||
1297 | set_kernel_exec((unsigned long)trampoline_base, trampoline_exec); | ||
1298 | #endif | ||
1299 | } | 1288 | } |
1300 | 1289 | ||
1301 | void __init smp_intr_init(void) | 1290 | void __init smp_intr_init(void) |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 08ba3a14c72c..016c8ccd1d8d 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -529,35 +529,6 @@ static void __init set_nx(void) | |||
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | /* | ||
533 | * Enables/disables executability of a given kernel page and | ||
534 | * returns the previous setting. | ||
535 | */ | ||
536 | int __init set_kernel_exec(unsigned long vaddr, int enable) | ||
537 | { | ||
538 | pte_t *pte; | ||
539 | int ret = 1; | ||
540 | int level; | ||
541 | |||
542 | if (!nx_enabled) | ||
543 | goto out; | ||
544 | |||
545 | pte = lookup_address(vaddr, &level); | ||
546 | BUG_ON(!pte); | ||
547 | |||
548 | if (!pte_exec(*pte)) | ||
549 | ret = 0; | ||
550 | |||
551 | if (enable) | ||
552 | pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); | ||
553 | else | ||
554 | pte->pte_high |= 1 << (_PAGE_BIT_NX - 32); | ||
555 | pte_update_defer(&init_mm, vaddr, pte); | ||
556 | __flush_tlb_all(); | ||
557 | out: | ||
558 | return ret; | ||
559 | } | ||
560 | |||
561 | #endif | 532 | #endif |
562 | 533 | ||
563 | /* | 534 | /* |
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h index 9381bd37b9b1..72eb06c2bac9 100644 --- a/include/asm-x86/pgtable_32.h +++ b/include/asm-x86/pgtable_32.h | |||
@@ -184,18 +184,6 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) | |||
184 | */ | 184 | */ |
185 | extern pte_t *lookup_address(unsigned long address, int *level); | 185 | extern pte_t *lookup_address(unsigned long address, int *level); |
186 | 186 | ||
187 | /* | ||
188 | * Make a given kernel text page executable/non-executable. | ||
189 | * Returns the previous executability setting of that page (which | ||
190 | * is used to restore the previous state). Used by the SMP bootup code. | ||
191 | * NOTE: this is an __init function for security reasons. | ||
192 | */ | ||
193 | #ifdef CONFIG_X86_PAE | ||
194 | extern int set_kernel_exec(unsigned long vaddr, int enable); | ||
195 | #else | ||
196 | static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} | ||
197 | #endif | ||
198 | |||
199 | #if defined(CONFIG_HIGHPTE) | 187 | #if defined(CONFIG_HIGHPTE) |
200 | #define pte_offset_map(dir, address) \ | 188 | #define pte_offset_map(dir, address) \ |
201 | ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) | 189 | ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) |