[PATCH] x86_64: Disable exception stack for stack faults
Linux Kernel Mailing List <[email protected]> Thu, 30 Jun 2005 22:45:23 -0700
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
tree d0ce9dbf6615dc17e2423d5967a940a2f667abb6 parent 3a36ef7ace64c507f6b087071429dbfed7d2a96d author Andi Kleen <[email protected]> Thu, 30 Jun 2005 15:46:32 +0200 committer Marcelo Tosatti <[email protected]> Fri, 01 Jul 2005 02:02:14 -0300 [PATCH] x86_64: Disable exception stack for stack faults 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 <[email protected]> arch/x86_64/kernel/traps.c | 2 +- include/asm-x86_64/processor.h | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -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); diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -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