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

Konstantin Belousov kib at FreeBSD.org
Wed Aug 2 10:12:12 UTC 2017


Author: kib
Date: Wed Aug  2 10:12:10 2017
New Revision: 321919
URL: https://svnweb.freebsd.org/changeset/base/321919

Log:
  Do not call trapsignal() after handling usermode fault or interrupt,
  when a signal is not intended to be sent.
  
  The variable holding the signal number to send is left uninitialized,
  which sometimes triggers invalid signal checks.
  
  For NMI, a return to usermode without ast processing is done.  On the
  other hand, for spurious dtrace probe interrupt it is usermode which
  triggered the interrupt, so handle it through userret() as any other
  fault.
  
  Reported by:	Nils Beyer <nbe at renzel.net>
  PR:	221151
  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  2 09:49:41 2017	(r321918)
+++ head/sys/amd64/amd64/trap.c	Wed Aug  2 10:12:10 2017	(r321919)
@@ -370,7 +370,7 @@ trap(struct trapframe *frame)
 #ifdef DEV_ISA
 		case T_NMI:
 			nmi_handle_intr(type, frame);
-			break;
+			goto out;
 #endif /* DEV_ISA */
 
 		case T_OFLOW:		/* integer overflow fault */
@@ -408,7 +408,7 @@ trap(struct trapframe *frame)
 			if (dtrace_return_probe_ptr != NULL &&
 			    dtrace_return_probe_ptr(&regs) == 0)
 				goto out;
-			break;
+			goto userout;
 #endif
 		}
 	} else {

Modified: head/sys/i386/i386/trap.c
==============================================================================
--- head/sys/i386/i386/trap.c	Wed Aug  2 09:49:41 2017	(r321918)
+++ head/sys/i386/i386/trap.c	Wed Aug  2 10:12:10 2017	(r321919)
@@ -455,7 +455,7 @@ user_trctrap_out:
 			goto userout;
 #else /* !POWERFAIL_NMI */
 			nmi_handle_intr(type, frame);
-			break;
+			goto out;
 #endif /* POWERFAIL_NMI */
 #endif /* DEV_ISA */
 
@@ -499,7 +499,7 @@ user_trctrap_out:
 			if (dtrace_return_probe_ptr != NULL &&
 			    dtrace_return_probe_ptr(&regs) == 0)
 				goto out;
-			break;
+			goto userout;
 #endif
 		}
 	} else {


More information about the svn-src-head mailing list