svn commit: r303913 - in head/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Wed Aug 10 13:44:04 UTC 2016


Author: kib
Date: Wed Aug 10 13:44:03 2016
New Revision: 303913
URL: https://svnweb.freebsd.org/changeset/base/303913

Log:
  Unconditionally perform checks that FPU region was entered, when #NM
  exception is caught in kernel mode.  There are third-party modules
  which trigger the issue, and since the problem causes usermode state
  corruption at least, panic in production kernels as well.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Wed Aug 10 13:38:44 2016	(r303912)
+++ head/sys/amd64/amd64/trap.c	Wed Aug 10 13:44:03 2016	(r303913)
@@ -443,8 +443,8 @@ trap(struct trapframe *frame)
 			goto out;
 
 		case T_DNA:
-			KASSERT(!PCB_USER_FPU(td->td_pcb),
-			    ("Unregistered use of FPU in kernel"));
+			if (PCB_USER_FPU(td->td_pcb))
+				panic("Unregistered use of FPU in kernel");
 			fpudna();
 			goto out;
 

Modified: head/sys/i386/i386/trap.c
==============================================================================
--- head/sys/i386/i386/trap.c	Wed Aug 10 13:38:44 2016	(r303912)
+++ head/sys/i386/i386/trap.c	Wed Aug 10 13:44:03 2016	(r303913)
@@ -540,8 +540,8 @@ trap(struct trapframe *frame)
 
 		case T_DNA:
 #ifdef DEV_NPX
-			KASSERT(!PCB_USER_FPU(td->td_pcb),
-			    ("Unregistered use of FPU in kernel"));
+			if (PCB_USER_FPU(td->td_pcb))
+				panic("Unregistered use of FPU in kernel");
 			if (npxdna())
 				goto out;
 #endif


More information about the svn-src-head mailing list