Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jul 2002 21:19:20 +0300 (EEST)
From:      unicorn@forest.od.ua
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/40354: crash, whith floating ops in kernel mode
Message-ID:  <200207081819.g68IJKKD021203@Rainbow.Deep.Forest>

next in thread | raw e-mail | index | archive | help

>Number:         40354
>Category:       i386
>Synopsis:       crash, whith floating ops in kernel mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 08 11:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     unicorn
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD Rainbow.Deep.Forest 5.0-CURRENT FreeBSD 5.0-CURRENT #10: Sun Jun 23 22:13:00 EEST 2002 root@Rainbow.Deep.Forest:/www/src/sys/i386/compile/RAINBOW i386

>Description:
	npx dna handler tries to modify curpcb even if it does not exist (yet).
	it couses page fault in kernel mode.
>How-To-Repeat:
	do some floating point operations before the first process created.
>Fix:

Index: npx.c
===================================================================
RCS file: /mnt/ncvs/src/sys/i386/isa/npx.c,v
retrieving revision 1.129
diff -u -r1.129 npx.c
--- npx.c	27 Mar 2002 05:39:20 -0000	1.129
+++ npx.c	8 Jul 2002 18:08:06 -0000
@@ -826,21 +826,27 @@
 	 */
 	PCPU_SET(fpcurthread, curthread);
 
-	exstat = GET_FPU_EXSW_PTR(PCPU_GET(curpcb));
-	*exstat = 0;
-	/*
-	 * The following frstor may cause an IRQ13 when the state being
-	 * restored has a pending error.  The error will appear to have been
-	 * triggered by the current (npx) user instruction even when that
-	 * instruction is a no-wait instruction that should not trigger an
-	 * error (e.g., fnclex).  On at least one 486 system all of the
-	 * no-wait instructions are broken the same as frstor, so our
-	 * treatment does not amplify the breakage.  On at least one
-	 * 386/Cyrix 387 system, fnclex works correctly while frstor and
-	 * fnsave are broken, so our treatment breaks fnclex if it is the
-	 * first FPU instruction after a context switch.
-	 */
-	fpurstor(&PCPU_GET(curpcb)->pcb_save);
+	if(PCPU_GET(curpcb) == NULL)
+	    printf("npxdna: Oops! No curpcb!\n");
+	else {
+	    exstat = GET_FPU_EXSW_PTR(PCPU_GET(curpcb));
+	    *exstat = 0;
+
+	    /*
+	     * The following frstor may cause an IRQ13 when the state being
+	     * restored has a pending error.  The error will appear to have been
+	     * triggered by the current (npx) user instruction even when that
+	     * instruction is a no-wait instruction that should not trigger an
+	     * error (e.g., fnclex).  On at least one 486 system all of the
+	     * no-wait instructions are broken the same as frstor, so our
+	     * treatment does not amplify the breakage.  On at least one
+	     * 386/Cyrix 387 system, fnclex works correctly while frstor and
+	     * fnsave are broken, so our treatment breaks fnclex if it is the
+	     * first FPU instruction after a context switch.
+	     */
+	    fpurstor(&PCPU_GET(curpcb)->pcb_save);
+	}
+    
 	intr_restore(s);
 
 	return (1);


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207081819.g68IJKKD021203>