diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/alternative.c | 55 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/amd.c | 3 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cyrix.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/mcheck/mce.c | 14 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/mtrr/cyrix.c | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/mtrr/state.c | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/perfctr-watchdog.c | 6 | ||||
-rw-r--r-- | arch/i386/kernel/kprobes.c | 9 | ||||
-rw-r--r-- | arch/i386/kernel/nmi.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/paravirt.c | 17 | ||||
-rw-r--r-- | arch/i386/kernel/signal.c | 7 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/traps.c | 24 | ||||
-rw-r--r-- | arch/i386/mm/fault.c | 10 | ||||
-rw-r--r-- | arch/i386/mm/init.c | 14 |
16 files changed, 135 insertions, 34 deletions
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c index 0695be538de..c3750c2c411 100644 --- a/arch/i386/kernel/alternative.c +++ b/arch/i386/kernel/alternative.c | |||
@@ -2,8 +2,14 @@ | |||
2 | #include <linux/sched.h> | 2 | #include <linux/sched.h> |
3 | #include <linux/spinlock.h> | 3 | #include <linux/spinlock.h> |
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/kprobes.h> | ||
6 | #include <linux/mm.h> | ||
7 | #include <linux/vmalloc.h> | ||
5 | #include <asm/alternative.h> | 8 | #include <asm/alternative.h> |
6 | #include <asm/sections.h> | 9 | #include <asm/sections.h> |
10 | #include <asm/pgtable.h> | ||
11 | #include <asm/mce.h> | ||
12 | #include <asm/nmi.h> | ||
7 | 13 | ||
8 | #ifdef CONFIG_HOTPLUG_CPU | 14 | #ifdef CONFIG_HOTPLUG_CPU |
9 | static int smp_alt_once; | 15 | static int smp_alt_once; |
@@ -150,7 +156,7 @@ static void nop_out(void *insns, unsigned int len) | |||
150 | unsigned int noplen = len; | 156 | unsigned int noplen = len; |
151 | if (noplen > ASM_NOP_MAX) | 157 | if (noplen > ASM_NOP_MAX) |
152 | noplen = ASM_NOP_MAX; | 158 | noplen = ASM_NOP_MAX; |
153 | memcpy(insns, noptable[noplen], noplen); | 159 | text_poke(insns, noptable[noplen], noplen); |
154 | insns += noplen; | 160 | insns += noplen; |
155 | len -= noplen; | 161 | len -= noplen; |
156 | } | 162 | } |
@@ -202,7 +208,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | |||
202 | continue; | 208 | continue; |
203 | if (*ptr > text_end) | 209 | if (*ptr > text_end) |
204 | continue; | 210 | continue; |
205 | **ptr = 0xf0; /* lock prefix */ | 211 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); /* add lock prefix */ |
206 | }; | 212 | }; |
207 | } | 213 | } |
208 | 214 | ||
@@ -360,10 +366,6 @@ void apply_paravirt(struct paravirt_patch_site *start, | |||
360 | /* Pad the rest with nops */ | 366 | /* Pad the rest with nops */ |
361 | nop_out(p->instr + used, p->len - used); | 367 | nop_out(p->instr + used, p->len - used); |
362 | } | 368 | } |
363 | |||
364 | /* Sync to be conservative, in case we patched following | ||
365 | * instructions */ | ||
366 | sync_core(); | ||
367 | } | 369 | } |
368 | extern struct paravirt_patch_site __start_parainstructions[], | 370 | extern struct paravirt_patch_site __start_parainstructions[], |
369 | __stop_parainstructions[]; | 371 | __stop_parainstructions[]; |
@@ -373,6 +375,14 @@ void __init alternative_instructions(void) | |||
373 | { | 375 | { |
374 | unsigned long flags; | 376 | unsigned long flags; |
375 | 377 | ||
378 | /* The patching is not fully atomic, so try to avoid local interruptions | ||
379 | that might execute the to be patched code. | ||
380 | Other CPUs are not running. */ | ||
381 | stop_nmi(); | ||
382 | #ifdef CONFIG_MCE | ||
383 | stop_mce(); | ||
384 | #endif | ||
385 | |||
376 | local_irq_save(flags); | 386 | local_irq_save(flags); |
377 | apply_alternatives(__alt_instructions, __alt_instructions_end); | 387 | apply_alternatives(__alt_instructions, __alt_instructions_end); |
378 | 388 | ||
@@ -405,4 +415,37 @@ void __init alternative_instructions(void) | |||
405 | #endif | 415 | #endif |
406 | apply_paravirt(__parainstructions, __parainstructions_end); | 416 | apply_paravirt(__parainstructions, __parainstructions_end); |
407 | local_irq_restore(flags); | 417 | local_irq_restore(flags); |
418 | |||
419 | restart_nmi(); | ||
420 | #ifdef CONFIG_MCE | ||
421 | restart_mce(); | ||
422 | #endif | ||
423 | } | ||
424 | |||
425 | /* | ||
426 | * Warning: | ||
427 | * When you use this code to patch more than one byte of an instruction | ||
428 | * you need to make sure that other CPUs cannot execute this code in parallel. | ||
429 | * Also no thread must be currently preempted in the middle of these instructions. | ||
430 | * And on the local CPU you need to be protected again NMI or MCE handlers | ||
431 | * seeing an inconsistent instruction while you patch. | ||
432 | */ | ||
433 | void __kprobes text_poke(void *oaddr, unsigned char *opcode, int len) | ||
434 | { | ||
435 | u8 *addr = oaddr; | ||
436 | if (!pte_write(*lookup_address((unsigned long)addr))) { | ||
437 | struct page *p[2] = { virt_to_page(addr), virt_to_page(addr+PAGE_SIZE) }; | ||
438 | addr = vmap(p, 2, VM_MAP, PAGE_KERNEL); | ||
439 | if (!addr) | ||
440 | return; | ||
441 | addr += ((unsigned long)oaddr) % PAGE_SIZE; | ||
442 | } | ||
443 | memcpy(addr, opcode, len); | ||
444 | sync_core(); | ||
445 | /* Not strictly needed, but can speed CPU recovery up. Ignore cross cacheline | ||
446 | case. */ | ||
447 | if (cpu_has_clflush) | ||
448 | asm("clflush (%0) " :: "r" (oaddr) : "memory"); | ||
449 | if (addr != oaddr) | ||
450 | vunmap(addr); | ||
408 | } | 451 | } |
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index 815a5f0aa47..c7ba455d5ac 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
@@ -231,6 +231,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
231 | 231 | ||
232 | switch (c->x86) { | 232 | switch (c->x86) { |
233 | case 15: | 233 | case 15: |
234 | /* Use K8 tuning for Fam10h and Fam11h */ | ||
235 | case 0x10: | ||
236 | case 0x11: | ||
234 | set_bit(X86_FEATURE_K8, c->x86_capability); | 237 | set_bit(X86_FEATURE_K8, c->x86_capability); |
235 | break; | 238 | break; |
236 | case 6: | 239 | case 6: |
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c index 194144539a6..461dabc4e49 100644 --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | |||
@@ -79,7 +79,7 @@ | |||
79 | #include <linux/smp.h> | 79 | #include <linux/smp.h> |
80 | #include <linux/cpufreq.h> | 80 | #include <linux/cpufreq.h> |
81 | #include <linux/pci.h> | 81 | #include <linux/pci.h> |
82 | #include <asm/processor.h> | 82 | #include <asm/processor-cyrix.h> |
83 | #include <asm/errno.h> | 83 | #include <asm/errno.h> |
84 | 84 | ||
85 | /* PCI config registers, all at F0 */ | 85 | /* PCI config registers, all at F0 */ |
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c index e88d2fba156..122d2d75aa9 100644 --- a/arch/i386/kernel/cpu/cyrix.c +++ b/arch/i386/kernel/cpu/cyrix.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | #include <asm/dma.h> | 5 | #include <asm/dma.h> |
6 | #include <asm/io.h> | 6 | #include <asm/io.h> |
7 | #include <asm/processor.h> | 7 | #include <asm/processor-cyrix.h> |
8 | #include <asm/timer.h> | 8 | #include <asm/timer.h> |
9 | #include <asm/pci-direct.h> | 9 | #include <asm/pci-direct.h> |
10 | #include <asm/tsc.h> | 10 | #include <asm/tsc.h> |
diff --git a/arch/i386/kernel/cpu/mcheck/mce.c b/arch/i386/kernel/cpu/mcheck/mce.c index 56cd485b127..34c781eddee 100644 --- a/arch/i386/kernel/cpu/mcheck/mce.c +++ b/arch/i386/kernel/cpu/mcheck/mce.c | |||
@@ -60,6 +60,20 @@ void mcheck_init(struct cpuinfo_x86 *c) | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | static unsigned long old_cr4 __initdata; | ||
64 | |||
65 | void __init stop_mce(void) | ||
66 | { | ||
67 | old_cr4 = read_cr4(); | ||
68 | clear_in_cr4(X86_CR4_MCE); | ||
69 | } | ||
70 | |||
71 | void __init restart_mce(void) | ||
72 | { | ||
73 | if (old_cr4 & X86_CR4_MCE) | ||
74 | set_in_cr4(X86_CR4_MCE); | ||
75 | } | ||
76 | |||
63 | static int __init mcheck_disable(char *str) | 77 | static int __init mcheck_disable(char *str) |
64 | { | 78 | { |
65 | mce_disabled = 1; | 79 | mce_disabled = 1; |
diff --git a/arch/i386/kernel/cpu/mtrr/cyrix.c b/arch/i386/kernel/cpu/mtrr/cyrix.c index 1001f1e0fe6..2287d4863a8 100644 --- a/arch/i386/kernel/cpu/mtrr/cyrix.c +++ b/arch/i386/kernel/cpu/mtrr/cyrix.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <asm/mtrr.h> | 3 | #include <asm/mtrr.h> |
4 | #include <asm/msr.h> | 4 | #include <asm/msr.h> |
5 | #include <asm/io.h> | 5 | #include <asm/io.h> |
6 | #include <asm/processor-cyrix.h> | ||
6 | #include "mtrr.h" | 7 | #include "mtrr.h" |
7 | 8 | ||
8 | int arr3_protected; | 9 | int arr3_protected; |
diff --git a/arch/i386/kernel/cpu/mtrr/state.c b/arch/i386/kernel/cpu/mtrr/state.c index 7b39a2f954d..c9014ca4a57 100644 --- a/arch/i386/kernel/cpu/mtrr/state.c +++ b/arch/i386/kernel/cpu/mtrr/state.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <asm/io.h> | 3 | #include <asm/io.h> |
4 | #include <asm/mtrr.h> | 4 | #include <asm/mtrr.h> |
5 | #include <asm/msr.h> | 5 | #include <asm/msr.h> |
6 | #include <asm-i386/processor-cyrix.h> | ||
6 | #include "mtrr.h" | 7 | #include "mtrr.h" |
7 | 8 | ||
8 | 9 | ||
diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c index 30b5e48aa76..4be488e73be 100644 --- a/arch/i386/kernel/cpu/perfctr-watchdog.c +++ b/arch/i386/kernel/cpu/perfctr-watchdog.c | |||
@@ -325,7 +325,7 @@ static struct wd_ops k7_wd_ops = { | |||
325 | .stop = single_msr_stop_watchdog, | 325 | .stop = single_msr_stop_watchdog, |
326 | .perfctr = MSR_K7_PERFCTR0, | 326 | .perfctr = MSR_K7_PERFCTR0, |
327 | .evntsel = MSR_K7_EVNTSEL0, | 327 | .evntsel = MSR_K7_EVNTSEL0, |
328 | .checkbit = 1ULL<<63, | 328 | .checkbit = 1ULL<<47, |
329 | }; | 329 | }; |
330 | 330 | ||
331 | /* Intel Model 6 (PPro+,P2,P3,P-M,Core1) */ | 331 | /* Intel Model 6 (PPro+,P2,P3,P-M,Core1) */ |
@@ -346,7 +346,9 @@ static int setup_p6_watchdog(unsigned nmi_hz) | |||
346 | perfctr_msr = MSR_P6_PERFCTR0; | 346 | perfctr_msr = MSR_P6_PERFCTR0; |
347 | evntsel_msr = MSR_P6_EVNTSEL0; | 347 | evntsel_msr = MSR_P6_EVNTSEL0; |
348 | 348 | ||
349 | wrmsrl(perfctr_msr, 0UL); | 349 | /* KVM doesn't implement this MSR */ |
350 | if (wrmsr_safe(perfctr_msr, 0, 0) < 0) | ||
351 | return 0; | ||
350 | 352 | ||
351 | evntsel = P6_EVNTSEL_INT | 353 | evntsel = P6_EVNTSEL_INT |
352 | | P6_EVNTSEL_OS | 354 | | P6_EVNTSEL_OS |
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index dde828a333c..448a50b1324 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
36 | #include <asm/desc.h> | 36 | #include <asm/desc.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
38 | #include <asm/alternative.h> | ||
38 | 39 | ||
39 | void jprobe_return_end(void); | 40 | void jprobe_return_end(void); |
40 | 41 | ||
@@ -169,16 +170,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
169 | 170 | ||
170 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 171 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
171 | { | 172 | { |
172 | *p->addr = BREAKPOINT_INSTRUCTION; | 173 | text_poke(p->addr, ((unsigned char []){BREAKPOINT_INSTRUCTION}), 1); |
173 | flush_icache_range((unsigned long) p->addr, | ||
174 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | ||
175 | } | 174 | } |
176 | 175 | ||
177 | void __kprobes arch_disarm_kprobe(struct kprobe *p) | 176 | void __kprobes arch_disarm_kprobe(struct kprobe *p) |
178 | { | 177 | { |
179 | *p->addr = p->opcode; | 178 | text_poke(p->addr, &p->opcode, 1); |
180 | flush_icache_range((unsigned long) p->addr, | ||
181 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | ||
182 | } | 179 | } |
183 | 180 | ||
184 | void __kprobes arch_remove_kprobe(struct kprobe *p) | 181 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index 03b7f5584d7..99beac7f96c 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c | |||
@@ -353,7 +353,7 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) | |||
353 | * Take the local apic timer and PIT/HPET into account. We don't | 353 | * Take the local apic timer and PIT/HPET into account. We don't |
354 | * know which one is active, when we have highres/dyntick on | 354 | * know which one is active, when we have highres/dyntick on |
355 | */ | 355 | */ |
356 | sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_irqs(0); | 356 | sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_cpu(cpu).irqs[0]; |
357 | 357 | ||
358 | /* if the none of the timers isn't firing, this cpu isn't doing much */ | 358 | /* if the none of the timers isn't firing, this cpu isn't doing much */ |
359 | if (!touched && last_irq_sums[cpu] == sum) { | 359 | if (!touched && last_irq_sums[cpu] == sum) { |
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c index 53f07a8275e..79c167fcaee 100644 --- a/arch/i386/kernel/paravirt.c +++ b/arch/i386/kernel/paravirt.c | |||
@@ -124,20 +124,28 @@ unsigned paravirt_patch_ignore(unsigned len) | |||
124 | return len; | 124 | return len; |
125 | } | 125 | } |
126 | 126 | ||
127 | struct branch { | ||
128 | unsigned char opcode; | ||
129 | u32 delta; | ||
130 | } __attribute__((packed)); | ||
131 | |||
127 | unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, | 132 | unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, |
128 | void *site, u16 site_clobbers, | 133 | void *site, u16 site_clobbers, |
129 | unsigned len) | 134 | unsigned len) |
130 | { | 135 | { |
131 | unsigned char *call = site; | 136 | unsigned char *call = site; |
132 | unsigned long delta = (unsigned long)target - (unsigned long)(call+5); | 137 | unsigned long delta = (unsigned long)target - (unsigned long)(call+5); |
138 | struct branch b; | ||
133 | 139 | ||
134 | if (tgt_clobbers & ~site_clobbers) | 140 | if (tgt_clobbers & ~site_clobbers) |
135 | return len; /* target would clobber too much for this site */ | 141 | return len; /* target would clobber too much for this site */ |
136 | if (len < 5) | 142 | if (len < 5) |
137 | return len; /* call too long for patch site */ | 143 | return len; /* call too long for patch site */ |
138 | 144 | ||
139 | *call++ = 0xe8; /* call */ | 145 | b.opcode = 0xe8; /* call */ |
140 | *(unsigned long *)call = delta; | 146 | b.delta = delta; |
147 | BUILD_BUG_ON(sizeof(b) != 5); | ||
148 | text_poke(call, (unsigned char *)&b, 5); | ||
141 | 149 | ||
142 | return 5; | 150 | return 5; |
143 | } | 151 | } |
@@ -150,8 +158,9 @@ unsigned paravirt_patch_jmp(void *target, void *site, unsigned len) | |||
150 | if (len < 5) | 158 | if (len < 5) |
151 | return len; /* call too long for patch site */ | 159 | return len; /* call too long for patch site */ |
152 | 160 | ||
153 | *jmp++ = 0xe9; /* jmp */ | 161 | b.opcode = 0xe9; /* jmp */ |
154 | *(unsigned long *)jmp = delta; | 162 | b.delta = delta; |
163 | text_poke(call, (unsigned char *)&b, 5); | ||
155 | 164 | ||
156 | return 5; | 165 | return 5; |
157 | } | 166 | } |
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c index d574e38f0f7..f5dd85656c1 100644 --- a/arch/i386/kernel/signal.c +++ b/arch/i386/kernel/signal.c | |||
@@ -199,6 +199,13 @@ asmlinkage int sys_sigreturn(unsigned long __unused) | |||
199 | return eax; | 199 | return eax; |
200 | 200 | ||
201 | badframe: | 201 | badframe: |
202 | if (show_unhandled_signals && printk_ratelimit()) | ||
203 | printk("%s%s[%d] bad frame in sigreturn frame:%p eip:%lx" | ||
204 | " esp:%lx oeax:%lx\n", | ||
205 | current->pid > 1 ? KERN_INFO : KERN_EMERG, | ||
206 | current->comm, current->pid, frame, regs->eip, | ||
207 | regs->esp, regs->orig_eax); | ||
208 | |||
202 | force_sig(SIGSEGV, current); | 209 | force_sig(SIGSEGV, current); |
203 | return 0; | 210 | return 0; |
204 | } | 211 | } |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 5910d3fac56..e4f61d1c624 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -308,7 +308,7 @@ cpumask_t cpu_coregroup_map(int cpu) | |||
308 | /* representing cpus for which sibling maps can be computed */ | 308 | /* representing cpus for which sibling maps can be computed */ |
309 | static cpumask_t cpu_sibling_setup_map; | 309 | static cpumask_t cpu_sibling_setup_map; |
310 | 310 | ||
311 | void set_cpu_sibling_map(int cpu) | 311 | void __cpuinit set_cpu_sibling_map(int cpu) |
312 | { | 312 | { |
313 | int i; | 313 | int i; |
314 | struct cpuinfo_x86 *c = cpu_data; | 314 | struct cpuinfo_x86 *c = cpu_data; |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 57772a18c39..cfffe3dd9e8 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -618,6 +618,13 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs, | |||
618 | 618 | ||
619 | current->thread.error_code = error_code; | 619 | current->thread.error_code = error_code; |
620 | current->thread.trap_no = 13; | 620 | current->thread.trap_no = 13; |
621 | if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) && | ||
622 | printk_ratelimit()) | ||
623 | printk(KERN_INFO | ||
624 | "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", | ||
625 | current->comm, current->pid, | ||
626 | regs->eip, regs->esp, error_code); | ||
627 | |||
621 | force_sig(SIGSEGV, current); | 628 | force_sig(SIGSEGV, current); |
622 | return; | 629 | return; |
623 | 630 | ||
@@ -768,6 +775,8 @@ static __kprobes void default_do_nmi(struct pt_regs * regs) | |||
768 | reassert_nmi(); | 775 | reassert_nmi(); |
769 | } | 776 | } |
770 | 777 | ||
778 | static int ignore_nmis; | ||
779 | |||
771 | fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) | 780 | fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) |
772 | { | 781 | { |
773 | int cpu; | 782 | int cpu; |
@@ -778,11 +787,24 @@ fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) | |||
778 | 787 | ||
779 | ++nmi_count(cpu); | 788 | ++nmi_count(cpu); |
780 | 789 | ||
781 | default_do_nmi(regs); | 790 | if (!ignore_nmis) |
791 | default_do_nmi(regs); | ||
782 | 792 | ||
783 | nmi_exit(); | 793 | nmi_exit(); |
784 | } | 794 | } |
785 | 795 | ||
796 | void stop_nmi(void) | ||
797 | { | ||
798 | acpi_nmi_disable(); | ||
799 | ignore_nmis++; | ||
800 | } | ||
801 | |||
802 | void restart_nmi(void) | ||
803 | { | ||
804 | ignore_nmis--; | ||
805 | acpi_nmi_enable(); | ||
806 | } | ||
807 | |||
786 | #ifdef CONFIG_KPROBES | 808 | #ifdef CONFIG_KPROBES |
787 | fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) | 809 | fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) |
788 | { | 810 | { |
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index e92a1012493..01ffdd4964f 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c | |||
@@ -283,6 +283,8 @@ static inline int vmalloc_fault(unsigned long address) | |||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | int show_unhandled_signals = 1; | ||
287 | |||
286 | /* | 288 | /* |
287 | * This routine handles page faults. It determines the address, | 289 | * This routine handles page faults. It determines the address, |
288 | * and the problem, and then passes it off to one of the appropriate | 290 | * and the problem, and then passes it off to one of the appropriate |
@@ -469,6 +471,14 @@ bad_area_nosemaphore: | |||
469 | if (is_prefetch(regs, address, error_code)) | 471 | if (is_prefetch(regs, address, error_code)) |
470 | return; | 472 | return; |
471 | 473 | ||
474 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | ||
475 | printk_ratelimit()) { | ||
476 | printk("%s%s[%d]: segfault at %08lx eip %08lx " | ||
477 | "esp %08lx error %lx\n", | ||
478 | tsk->pid > 1 ? KERN_INFO : KERN_EMERG, | ||
479 | tsk->comm, tsk->pid, address, regs->eip, | ||
480 | regs->esp, error_code); | ||
481 | } | ||
472 | tsk->thread.cr2 = address; | 482 | tsk->thread.cr2 = address; |
473 | /* Kernel addresses are always protection faults */ | 483 | /* Kernel addresses are always protection faults */ |
474 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); | 484 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); |
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index e1a9a805c44..c3b9905af2d 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -800,17 +800,9 @@ void mark_rodata_ro(void) | |||
800 | unsigned long start = PFN_ALIGN(_text); | 800 | unsigned long start = PFN_ALIGN(_text); |
801 | unsigned long size = PFN_ALIGN(_etext) - start; | 801 | unsigned long size = PFN_ALIGN(_etext) - start; |
802 | 802 | ||
803 | #ifndef CONFIG_KPROBES | 803 | change_page_attr(virt_to_page(start), |
804 | #ifdef CONFIG_HOTPLUG_CPU | 804 | size >> PAGE_SHIFT, PAGE_KERNEL_RX); |
805 | /* It must still be possible to apply SMP alternatives. */ | 805 | printk("Write protecting the kernel text: %luk\n", size >> 10); |
806 | if (num_possible_cpus() <= 1) | ||
807 | #endif | ||
808 | { | ||
809 | change_page_attr(virt_to_page(start), | ||
810 | size >> PAGE_SHIFT, PAGE_KERNEL_RX); | ||
811 | printk("Write protecting the kernel text: %luk\n", size >> 10); | ||
812 | } | ||
813 | #endif | ||
814 | start += size; | 806 | start += size; |
815 | size = (unsigned long)__end_rodata - start; | 807 | size = (unsigned long)__end_rodata - start; |
816 | change_page_attr(virt_to_page(start), | 808 | change_page_attr(virt_to_page(start), |