git: 974be51b3f60 - main - Fixes for ptrace_syscallreq()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Dec 2022 23:53:58 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=974be51b3f6070f9aae02e115ea6099f90bc9175 commit 974be51b3f6070f9aae02e115ea6099f90bc9175 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-12-22 23:51:34 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-22 23:53:41 +0000 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 --- sys/kern/kern_sig.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index df40cdf404db..e0ef60d0ca20 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -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];