changeset 13356:ae254853587f

789 dtrace may drop instructions when rapidly signalled Reviewed by: Robert Mustacchi <robert.mustacchi@joyent.com> Reviewed by: David Pacheco <dap@joyent.com> Approved by: Garrett D'Amore <garrett@nexenta.com>
author Bryan Cantrill <bryan@joyent.com>
date Wed, 09 Mar 2011 23:33:10 -0800
parents 15b74a2a9a9d
children af2b8df56c61
files usr/src/uts/i86pc/os/dtrace_subr.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/os/dtrace_subr.c	Tue Feb 08 01:46:16 2011 -0800
+++ b/usr/src/uts/i86pc/os/dtrace_subr.c	Wed Mar 09 23:33:10 2011 -0800
@@ -24,6 +24,10 @@
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ */
+
 #include <sys/dtrace.h>
 #include <sys/fasttrap.h>
 #include <sys/x_call.h>
@@ -332,14 +336,15 @@
 	}
 
 	/*
-	 * If we've executed the original instruction, but haven't performed
-	 * the jmp back to t->t_dtrace_npc or the clean up of any registers
-	 * used to emulate %rip-relative instructions in 64-bit mode, do that
-	 * here and take the signal right away. We detect this condition by
-	 * seeing if the program counter is the range [scrpc + isz, astpc).
+	 * If we have executed the original instruction, but we have performed
+	 * neither the jmp back to t->t_dtrace_npc nor the clean up of any
+	 * registers used to emulate %rip-relative instructions in 64-bit mode,
+	 * we'll save ourselves some effort by doing that here and taking the
+	 * signal right away.  We detect this condition by seeing if the program
+	 * counter is the range [scrpc + isz, astpc).
 	 */
-	if (t->t_dtrace_astpc - rp->r_pc <
-	    t->t_dtrace_astpc - t->t_dtrace_scrpc - isz) {
+	if (rp->r_pc >= t->t_dtrace_scrpc + isz &&
+	    rp->r_pc < t->t_dtrace_astpc) {
 #ifdef __amd64
 		/*
 		 * If there is a scratch register and we're on the