Date: Sat, 26 Oct 2013 03:21:54 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257143 - head/sys/cddl/contrib/opensolaris/uts/intel/dtrace Message-ID: <201310260321.r9Q3LsSB074539@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sat Oct 26 03:21:54 2013 New Revision: 257143 URL: http://svnweb.freebsd.org/changeset/base/257143 Log: Fix a couple of bugs in the fasttrap emulation of a "push %rbp" instruction: the code was trying to save the stack pointer rather than the frame pointer, and the arguments to copyout(9) were reversed, so nothing ended up being saved on the stack. This would cause process crashes when the pid provider was being used to instrument calls of a function starting with this instruction. Reported by: symbolics@gmx.com Tested by: symbolics@gmx.com (earlier version) MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Oct 26 03:21:08 2013 (r257142) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Oct 26 03:21:54 2013 (r257143) @@ -104,6 +104,7 @@ uwrite(proc_t *p, void *kaddr, size_t le #define r_rip r_eip #define r_rflags r_eflags #define r_rsp r_esp +#define r_rbp r_ebp #endif /* @@ -1394,29 +1395,27 @@ fasttrap_pid_probe(struct reg *rp) case FASTTRAP_T_PUSHL_EBP: { int ret = 0; - uintptr_t addr = 0; #ifdef __amd64 if (p->p_model == DATAMODEL_NATIVE) { - addr = rp->r_rsp - sizeof (uintptr_t); - ret = fasttrap_sulword((void *)addr, &rp->r_rsp); + rp->r_rsp -= sizeof (uintptr_t); + ret = fasttrap_sulword(&rp->r_rbp, (void *)rp->r_rsp); } else { #endif #ifdef __i386__ - addr = rp->r_rsp - sizeof (uint32_t); - ret = fasttrap_suword32((void *)addr, &rp->r_rsp); + rp->r_rsp -= sizeof (uint32_t); + ret = fasttrap_suword32(&rp->r_rbp, (void *)rp->r_rsp); #endif #ifdef __amd64 } #endif if (ret == -1) { - fasttrap_sigsegv(p, curthread, addr); + fasttrap_sigsegv(p, curthread, rp->r_rsp); new_pc = pc; break; } - rp->r_rsp = addr; new_pc = pc + tp->ftt_size; break; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310260321.r9Q3LsSB074539>