OSDN Git Service

[PATCH] x86_64: Disable exception stack for stack faults
authorAndi Kleen <ak@suse.de>
Thu, 30 Jun 2005 13:46:32 +0000 (15:46 +0200)
committerMarcelo Tosatti <marcelo.tosatti@cyclades.com>
Thu, 30 Jun 2005 23:02:14 +0000 (20:02 -0300)
Stack segment faults were executed on a exception stack. But they
use the normal return path and can schedule there, but scheduling
is not allowed on a exception stack.

Just drop the exception stack for stack segment faults. This
will make some oops triple fault now, but that's better than
allowing user triggerable oops.

Double faults still have this problem,  but if they happen you
have enough other problems already that this one doesn't matter
anymore.

2.6 has a more complicated fix here that actually handles
this properly, but for 2.4 the simple version is better.

Found from RedHat QA using crashme

Signed-off-by: Andi Kleen <ak@suse.de>
arch/x86_64/kernel/traps.c
include/asm-x86_64/processor.h

index e3fdfe1..16c0418 100644 (file)
@@ -857,7 +857,7 @@ void __init trap_init(void)
        set_intr_gate(9,&coprocessor_segment_overrun);
        set_intr_gate(10,&invalid_TSS);
        set_intr_gate(11,&segment_not_present);
-       set_intr_gate_ist(12,&stack_segment,STACKFAULT_STACK);
+       set_intr_gate(12,&stack_segment);
        set_intr_gate(13,&general_protection);
        set_intr_gate(14,&page_fault);
        set_intr_gate(15,&spurious_interrupt_bug);
index 3e7cac6..45342a9 100644 (file)
@@ -325,10 +325,9 @@ struct thread_struct {
 #define INIT_MMAP \
 { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
 
-#define STACKFAULT_STACK 1
-#define DOUBLEFAULT_STACK 2 
-#define NMI_STACK 3 
-#define N_EXCEPTION_STACKS 3  /* hw limit: 7 */
+#define DOUBLEFAULT_STACK 1
+#define NMI_STACK 2
+#define N_EXCEPTION_STACKS 2  /* hw limit: 7 */
 #define EXCEPTION_STKSZ PAGE_SIZE
 #define EXCEPTION_STK_ORDER 0