Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2017 10:12:10 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321919 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201708021012.v72ACAZX060912@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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 {



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