From owner-svn-src-stable@freebsd.org Thu Jan 4 16:17:37 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E3E7EC09C8; Thu, 4 Jan 2018 16:17:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A055B7136A; Thu, 4 Jan 2018 16:17:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w04GHWE4050736; Thu, 4 Jan 2018 16:17:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w04GHViu050729; Thu, 4 Jan 2018 16:17:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201801041617.w04GHViu050729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 4 Jan 2018 16:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327551 - in stable/11/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/sys cddl/contrib/opensolaris/uts/intel/dtrace cddl/contrib/opensolaris/uts/powerpc/dtrace i386/i386 powerpc/p... X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/sys cddl/contrib/opensolaris/uts/intel/dtrace cddl/contrib/opensolaris/uts/powerpc/dtrace i386/i386 powerpc/powerpc sys X-SVN-Commit-Revision: 327551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jan 2018 16:17:37 -0000 Author: markj Date: Thu Jan 4 16:17:31 2018 New Revision: 327551 URL: https://svnweb.freebsd.org/changeset/base/327551 Log: MFC r326774, r326811: Pass the trap frame to fasttrap hooks. Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h stable/11/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c stable/11/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c stable/11/sys/i386/i386/trap.c stable/11/sys/powerpc/powerpc/trap.c stable/11/sys/sys/dtrace_bsd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/amd64/amd64/trap.c Thu Jan 4 16:17:31 2018 (r327551) @@ -162,9 +162,6 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG void trap(struct trapframe *frame) { -#ifdef KDTRACE_HOOKS - struct reg regs; -#endif ksiginfo_t ksi; struct thread *td; struct proc *p; @@ -276,9 +273,8 @@ trap(struct trapframe *frame) enable_intr(); #ifdef KDTRACE_HOOKS if (type == T_BPTFLT) { - fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) + dtrace_pid_probe_ptr(frame) == 0) return; } #endif @@ -404,9 +400,8 @@ trap(struct trapframe *frame) #ifdef KDTRACE_HOOKS case T_DTRACE_RET: enable_intr(); - fill_frame_regs(frame, ®s); if (dtrace_return_probe_ptr != NULL) - dtrace_return_probe_ptr(®s); + dtrace_return_probe_ptr(frame); return; #endif } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jan 4 16:17:31 2018 (r327551) @@ -221,9 +221,9 @@ extern int fasttrap_tracepoint_init(proc_t *, fasttrap extern int fasttrap_tracepoint_install(proc_t *, fasttrap_tracepoint_t *); extern int fasttrap_tracepoint_remove(proc_t *, fasttrap_tracepoint_t *); -struct reg; -extern int fasttrap_pid_probe(struct reg *); -extern int fasttrap_return_probe(struct reg *); +struct trapframe; +extern int fasttrap_pid_probe(struct trapframe *); +extern int fasttrap_return_probe(struct trapframe *); extern uint64_t fasttrap_pid_getarg(void *, dtrace_id_t, void *, int, int); extern uint64_t fasttrap_usdt_getarg(void *, dtrace_id_t, void *, int, int); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jan 4 16:17:31 2018 (r327551) @@ -967,14 +967,12 @@ fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg } int -fasttrap_pid_probe(struct reg *rp) +fasttrap_pid_probe(struct trapframe *tf) { - proc_t *p = curproc; -#ifndef illumos + struct reg reg, *rp; + proc_t *p = curproc, *pp; struct rm_priotracker tracker; - proc_t *pp; -#endif - uintptr_t pc = rp->r_rip - 1; + uintptr_t pc; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; #ifdef illumos @@ -985,6 +983,11 @@ fasttrap_pid_probe(struct reg *rp) dtrace_icookie_t cookie; uint_t is_enabled = 0; + fill_frame_regs(tf, ®); + rp = ® + + pc = rp->r_rip - 1; + /* * It's possible that a user (in a veritable orgy of bad planning) * could redirect this thread's flow of control before it reached the @@ -1796,12 +1799,16 @@ done: } int -fasttrap_return_probe(struct reg *rp) +fasttrap_return_probe(struct trapframe *tf) { + struct reg reg, *rp; proc_t *p = curproc; uintptr_t pc = curthread->t_dtrace_pc; uintptr_t npc = curthread->t_dtrace_npc; + fill_frame_regs(tf, ®); + rp = ® + curthread->t_dtrace_pc = 0; curthread->t_dtrace_npc = 0; curthread->t_dtrace_scrpc = 0; @@ -1821,9 +1828,7 @@ fasttrap_return_probe(struct reg *rp) /* * We set rp->r_rip to the address of the traced instruction so * that it appears to dtrace_probe() that we're on the original - * instruction, and so that the user can't easily detect our - * complex web of lies. dtrace_return_probe() (our caller) - * will correctly set %pc after we return. + * instruction. */ rp->r_rip = pc; Modified: stable/11/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c Thu Jan 4 16:17:31 2018 (r327551) @@ -328,11 +328,12 @@ fasttrap_branch_taken(int bo, int bi, struct reg *regs int -fasttrap_pid_probe(struct reg *rp) +fasttrap_pid_probe(struct trapframe *frame) { + struct reg reg, *rp; struct rm_priotracker tracker; proc_t *p = curproc; - uintptr_t pc = rp->pc; + uintptr_t pc; uintptr_t new_pc = 0; fasttrap_bucket_t *bucket; fasttrap_tracepoint_t *tp, tp_local; @@ -340,6 +341,10 @@ fasttrap_pid_probe(struct reg *rp) dtrace_icookie_t cookie; uint_t is_enabled = 0; + fill_regs(curthread, ®); + rp = ® + pc = rp->pc; + /* * It's possible that a user (in a veritable orgy of bad planning) * could redirect this thread's flow of control before it reached the @@ -515,8 +520,9 @@ done: } int -fasttrap_return_probe(struct reg *rp) +fasttrap_return_probe(struct trapframe *tf) { + struct reg reg, *rp; proc_t *p = curproc; uintptr_t pc = curthread->t_dtrace_pc; uintptr_t npc = curthread->t_dtrace_npc; @@ -526,12 +532,13 @@ fasttrap_return_probe(struct reg *rp) curthread->t_dtrace_scrpc = 0; curthread->t_dtrace_astpc = 0; + fill_regs(curthread, ®); + rp = ® + /* * We set rp->pc to the address of the traced instruction so * that it appears to dtrace_probe() that we're on the original - * instruction, and so that the user can't easily detect our - * complex web of lies. dtrace_return_probe() (our caller) - * will correctly set %pc after we return. + * instruction. */ rp->pc = pc; @@ -539,4 +546,3 @@ fasttrap_return_probe(struct reg *rp) return (0); } - Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/i386/i386/trap.c Thu Jan 4 16:17:31 2018 (r327551) @@ -175,9 +175,6 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG void trap(struct trapframe *frame) { -#ifdef KDTRACE_HOOKS - struct reg regs; -#endif ksiginfo_t ksi; struct thread *td; struct proc *p; @@ -325,9 +322,8 @@ trap(struct trapframe *frame) enable_intr(); #ifdef KDTRACE_HOOKS if (type == T_BPTFLT) { - fill_frame_regs(frame, ®s); if (dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) + dtrace_pid_probe_ptr(frame) == 0) return; } #endif @@ -495,9 +491,8 @@ user_trctrap_out: #ifdef KDTRACE_HOOKS case T_DTRACE_RET: enable_intr(); - fill_frame_regs(frame, ®s); if (dtrace_return_probe_ptr != NULL) - dtrace_return_probe_ptr(®s); + dtrace_return_probe_ptr(frame); return; #endif } Modified: stable/11/sys/powerpc/powerpc/trap.c ============================================================================== --- stable/11/sys/powerpc/powerpc/trap.c Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/powerpc/powerpc/trap.c Thu Jan 4 16:17:31 2018 (r327551) @@ -299,9 +299,7 @@ trap(struct trapframe *frame) inst = fuword32((const void *)frame->srr0); if (inst == 0x0FFFDDDD && dtrace_pid_probe_ptr != NULL) { - struct reg regs; - fill_regs(td, ®s); - (*dtrace_pid_probe_ptr)(®s); + (*dtrace_pid_probe_ptr)(frame); break; } #endif Modified: stable/11/sys/sys/dtrace_bsd.h ============================================================================== --- stable/11/sys/sys/dtrace_bsd.h Thu Jan 4 15:57:49 2018 (r327550) +++ stable/11/sys/sys/dtrace_bsd.h Thu Jan 4 16:17:31 2018 (r327551) @@ -37,7 +37,6 @@ struct trapframe; struct thread; struct vattr; struct vnode; -struct reg; int dtrace_trap(struct trapframe *, u_int); @@ -58,9 +57,9 @@ typedef void (*dtrace_doubletrap_func_t)(void); extern dtrace_doubletrap_func_t dtrace_doubletrap_func; /* Pid provider hooks */ -typedef int (*dtrace_pid_probe_ptr_t)(struct reg *); +typedef int (*dtrace_pid_probe_ptr_t)(struct trapframe *); extern dtrace_pid_probe_ptr_t dtrace_pid_probe_ptr; -typedef int (*dtrace_return_probe_ptr_t)(struct reg *); +typedef int (*dtrace_return_probe_ptr_t)(struct trapframe *); extern dtrace_return_probe_ptr_t dtrace_return_probe_ptr; /* Virtual time hook function type. */