diff options
Diffstat (limited to 'sys/kern/subr_syscall.c')
-rw-r--r-- | sys/kern/subr_syscall.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 0182884..2bcad34 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -52,15 +52,13 @@ __FBSDID("$FreeBSD$"); #include <security/audit/audit.h> static inline int -syscallenter(struct thread *td) +syscallenter(struct thread *td, struct syscall_args *sa) { struct proc *p; - struct syscall_args *sa; int error, traced; PCPU_INC(cnt.v_syscall); p = td->td_proc; - sa = &td->td_sa; td->td_pticks = 0; if (td->td_cowgen != p->p_cowgen) @@ -73,7 +71,7 @@ syscallenter(struct thread *td) td->td_dbgflags |= TDB_SCE; PROC_UNLOCK(p); } - error = (p->p_sysent->sv_fetch_syscall_args)(td); + error = (p->p_sysent->sv_fetch_syscall_args)(td, sa); #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) ktrsyscall(sa->code, sa->narg, sa->args); @@ -87,6 +85,8 @@ syscallenter(struct thread *td) STOPEVENT(p, S_SCE, sa->narg); if (p->p_flag & P_TRACED) { PROC_LOCK(p); + td->td_dbg_sc_code = sa->code; + td->td_dbg_sc_narg = sa->narg; if (p->p_ptevents & PTRACE_SCE) ptracestop((td), SIGTRAP, NULL); PROC_UNLOCK(p); @@ -96,7 +96,11 @@ syscallenter(struct thread *td) * Reread syscall number and arguments if * debugger modified registers or memory. */ - error = (p->p_sysent->sv_fetch_syscall_args)(td); + error = (p->p_sysent->sv_fetch_syscall_args)(td, sa); + PROC_LOCK(p); + td->td_dbg_sc_code = sa->code; + td->td_dbg_sc_narg = sa->narg; + PROC_UNLOCK(p); #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) ktrsyscall(sa->code, sa->narg, sa->args); @@ -158,10 +162,9 @@ syscallenter(struct thread *td) } static inline void -syscallret(struct thread *td, int error) +syscallret(struct thread *td, int error, struct syscall_args *sa) { struct proc *p, *p2; - struct syscall_args *sa; ksiginfo_t ksi; int traced, error1; @@ -169,7 +172,6 @@ syscallret(struct thread *td, int error) ("fork() did not clear TDP_FORKING upon completion")); p = td->td_proc; - sa = &td->td_sa; if ((trap_enotcap || (p->p_flag2 & P2_TRAPCAP) != 0) && IN_CAPABILITY_MODE(td)) { error1 = (td->td_pflags & TDP_NERRNO) == 0 ? error : |