linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Linus Torvalds <torvalds@transmeta.com>,
	"linux-kernel@vger.redhat.com" <linux-kernel@vger.kernel.org>
Subject: Possible cause of SegFaults
Date: Thu, 02 Nov 2000 12:10:08 -0800	[thread overview]
Message-ID: <3A01CA20.707AFC1A@mvista.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

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.

George

[-- Attachment #2: segfault.patch --]
[-- Type: text/plain, Size: 980 bytes --]

diff -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;

                 reply	other threads:[~2000-11-02 20:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A01CA20.707AFC1A@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).