lkml.org 
[lkml]   [2000]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPossible cause of SegFaults
Linus,

In doing the full preemption testing we found and fixed this little
segfault window. Seems that interrupts are left on for the page fault.
This allows an interrupt prior to fetching the faulting info from CR2.
Result, illegal memory reference, i.e. segfault. I don't know what
interrupt code might touch CR2, but better safe than sorry. Of course,
preemption in this window _IS_ a problem.

Attached find a patch to fix the problem. The patch is on 2.4.0-test9
but should apply to most of 2.4.0 versions.

Georgediff -urP -X patch.exclude linux-2.4.0-test9-kb-rts/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
--- linux-2.4.0-test9-kb-rts/arch/i386/kernel/traps.c Mon Oct 30 21:04:29 2000
+++ linux/arch/i386/kernel/traps.c Wed Nov 1 12:42:40 2000
@@ -1028,7 +1028,7 @@
set_trap_gate(11,&segment_not_present);
set_trap_gate(12,&stack_segment);
set_trap_gate(13,&general_protection);
- set_trap_gate(14,&page_fault);
+ set_intr_gate(14,&page_fault);
set_trap_gate(15,&spurious_interrupt_bug);
set_trap_gate(16,&coprocessor_error);
set_trap_gate(17,&alignment_check);
diff -urP -X patch.exclude linux-2.4.0-test9-kb-rts/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c
--- linux-2.4.0-test9-kb-rts/arch/i386/mm/fault.c Mon Oct 30 21:04:29 2000
+++ linux/arch/i386/mm/fault.c Thu Nov 2 09:57:02 2000
@@ -130,7 +130,7 @@

/* get the address */
__asm__("movl %%cr2,%0":"=r" (address));
-
+ __sti();
tsk = current;
mm = tsk->mm;
info.si_code = SEGV_MAPERR;
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.085 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site