Project

General

Profile

Actions

Bug #789

closed

dtrace may drop instructions when rapidly signalled

Added by Damian Wojslaw about 12 years ago. Updated about 12 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
kernel
Start date:
2011-03-09
Due date:
% Done:

100%

Estimated time:
Difficulty:
Tags:
Gerrit CR:
External Bug:

Description

As described here, by Bryan Cantrill http://dtrace.org/blogs/bmc/2011/03/09/when-magic-collides/
Patch, by Bryan, inline

diff --git a/usr/src/uts/i86pc/os/dtrace_subr.c b/usr/src/uts/i86pc/os/dtrace_subr.c
index baf7919..e8452c0 100644
--- a/usr/src/uts/i86pc/os/dtrace_subr.c
+++ b/usr/src/uts/i86pc/os/dtrace_subr.c
@@ -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 @@ dtrace_safe_defer_signal(void)
     }

     /*
-     * 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

Actions #1

Updated by Rich Lowe about 12 years ago

  • Category set to kernel
  • Status changed from New to In Progress
  • Assignee set to Rich Lowe

This is in the joyent tree, and I'll bring this over as I go through their DTrace changes.

Actions #2

Updated by Rich Lowe about 12 years ago

  • Subject changed from DTrace can lead to dropping instruction execution in specific conditions to dtrace may drop instructions when rapidly signalled
Actions #3

Updated by Rich Lowe about 12 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Resolved in r13356 commit:ae254853587f

Actions

Also available in: Atom PDF