summaryrefslogtreecommitdiffstats
path: root/sys/cddl/dev/dtrace/i386/dtrace_isa.c
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2014-08-05 01:53:15 +0000
committermarkj <markj@FreeBSD.org>2014-08-05 01:53:15 +0000
commitf50ec1f79f9ae8ff85a176d544e21283367f96f5 (patch)
tree9ff67f5aeee3c92448948fcec9dc58a82016454b /sys/cddl/dev/dtrace/i386/dtrace_isa.c
parent7e5599557db7c93bc578adef4acdfa84baf887b2 (diff)
downloadFreeBSD-src-f50ec1f79f9ae8ff85a176d544e21283367f96f5.zip
FreeBSD-src-f50ec1f79f9ae8ff85a176d544e21283367f96f5.tar.gz
MFC r267759, r267761
r267759: Fix a couple of bugs on amd64 when fetching probe arguments beyond the first five for probes entered through a UD fault (i.e. FBT probes). Specifically, handle the fact that dtrace_invop_callsite must be 16 byte-aligned and thus may not immediately follow the call to dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and the stack pointer through a struct trapframe instead of a struct reg. r267761: Fix some bugs when fetching probe arguments in i386. Firstly ensure that the 4 byte-aligned dtrace_invop_callsite can be found and that it immediately follows the call to dtrace_invop(). Secondly, fix some pointer arithmetic to account for differences between struct i386_frame and illumos' struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works by following a fixed number of frame pointers to the probe site, so inlining breaks it. PR: 191260
Diffstat (limited to 'sys/cddl/dev/dtrace/i386/dtrace_isa.c')
-rw-r--r--sys/cddl/dev/dtrace/i386/dtrace_isa.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/cddl/dev/dtrace/i386/dtrace_isa.c b/sys/cddl/dev/dtrace/i386/dtrace_isa.c
index 3f73a50..21a8154 100644
--- a/sys/cddl/dev/dtrace/i386/dtrace_isa.c
+++ b/sys/cddl/dev/dtrace/i386/dtrace_isa.c
@@ -413,7 +413,8 @@ dtrace_getarg(int arg, int aframes)
for (i = 1; i <= aframes; i++) {
fp = fp->f_frame;
- if (fp->f_retaddr == (long)dtrace_invop_callsite) {
+ if (P2ROUNDUP(fp->f_retaddr, 4) ==
+ (long)dtrace_invop_callsite) {
/*
* If we pass through the invalid op handler, we will
* use the pointer that it passed to the stack as the
@@ -422,7 +423,7 @@ dtrace_getarg(int arg, int aframes)
* beyond the EIP/RIP that was pushed when the trap was
* taken -- hence the "+ 1" below.
*/
- stack = ((uintptr_t **)&fp[1])[1] + 1;
+ stack = ((uintptr_t **)&fp[1])[0] + 1;
goto load;
}
@@ -438,7 +439,7 @@ dtrace_getarg(int arg, int aframes)
*/
arg++;
- stack = (uintptr_t *)&fp[1];
+ stack = (uintptr_t *)fp + 2;
load:
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
OpenPOWER on IntegriCloud