Fixes for ptrace_syscallreq()
Re-assign the sc local (syscall number) before moving args for SYS_syscall. Correct the audit and kdtrace hooks invocations. Fixes: 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68 Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
6403a14024
commit
974be51b3f
@ -2672,6 +2672,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p,
|
||||
|
||||
sc = tsr->ts_sa.code;
|
||||
if (sc == SYS_syscall || sc == SYS___syscall) {
|
||||
sc = tsr->ts_sa.args[0];
|
||||
memmove(&tsr->ts_sa.args[0], &tsr->ts_sa.args[1],
|
||||
sizeof(register_t) * (tsr->ts_nargs - 1));
|
||||
}
|
||||
@ -2692,7 +2693,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p,
|
||||
#endif
|
||||
|
||||
sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0;
|
||||
audited = AUDIT_SYSCALL_ENTER(tsr->ts_syscall, td) != 0;
|
||||
audited = AUDIT_SYSCALL_ENTER(sc, td) != 0;
|
||||
|
||||
if (!sy_thr_static) {
|
||||
error = syscall_thread_enter(td, se);
|
||||
@ -2716,7 +2717,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p,
|
||||
#ifdef KDTRACE_HOOKS
|
||||
if (se->sy_return != 0)
|
||||
(*systrace_probe_func)(&tsr->ts_sa, SYSTRACE_RETURN,
|
||||
tsr->ts_ret->sr_error != 0 ? -1 : td->td_retval[0]);
|
||||
tsr->ts_ret.sr_error != 0 ? -1 : td->td_retval[0]);
|
||||
#endif
|
||||
|
||||
tsr->ts_ret.sr_retval[0] = td->td_retval[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user