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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to