summaryrefslogtreecommitdiff
path: root/sys/kern/subr_syscall.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2020-10-28 14:43:38 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2020-10-28 14:43:38 +0000
commitbdc0cb4e2c33ddec327538397b190daef71058ae (patch)
tree1b9675f5001ca0059df984e79be85deda93a6dd7 /sys/kern/subr_syscall.c
parent1701c69b6e381f5406968826ce4c8d524c76e3cf (diff)
downloadsrc-test2-bdc0cb4e2c33ddec327538397b190daef71058ae.tar.gz
src-test2-bdc0cb4e2c33ddec327538397b190daef71058ae.zip
Notes
Diffstat (limited to 'sys/kern/subr_syscall.c')
-rw-r--r--sys/kern/subr_syscall.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c
index 381756b37323..bc5dafaf921c 100644
--- a/sys/kern/subr_syscall.c
+++ b/sys/kern/subr_syscall.c
@@ -59,6 +59,7 @@ syscallenter(struct thread *td)
{
struct proc *p;
struct syscall_args *sa;
+ struct sysent *se;
int error, traced;
VM_CNT_INC(v_syscall);
@@ -77,9 +78,10 @@ syscallenter(struct thread *td)
PROC_UNLOCK(p);
}
error = (p->p_sysent->sv_fetch_syscall_args)(td);
+ se = sa->callp;
#ifdef KTRACE
if (KTRPOINT(td, KTR_SYSCALL))
- ktrsyscall(sa->code, sa->callp->sy_narg, sa->args);
+ ktrsyscall(sa->code, se->sy_narg, sa->args);
#endif
KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code),
(uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0],
@@ -102,9 +104,10 @@ syscallenter(struct thread *td)
* modified registers or memory.
*/
error = (p->p_sysent->sv_fetch_syscall_args)(td);
+ se = sa->callp;
#ifdef KTRACE
if (KTRPOINT(td, KTR_SYSCALL))
- ktrsyscall(sa->code, sa->callp->sy_narg, sa->args);
+ ktrsyscall(sa->code, se->sy_narg, sa->args);
#endif
if (error != 0) {
td->td_errno = error;
@@ -118,13 +121,13 @@ syscallenter(struct thread *td)
* flagged with SYF_CAPENABLED.
*/
if (__predict_false(IN_CAPABILITY_MODE(td) &&
- !(sa->callp->sy_flags & SYF_CAPENABLED))) {
+ (se->sy_flags & SYF_CAPENABLED) == 0)) {
td->td_errno = error = ECAPMODE;
goto retval;
}
#endif
- error = syscall_thread_enter(td, sa->callp);
+ error = syscall_thread_enter(td, se);
if (error != 0) {
td->td_errno = error;
goto retval;
@@ -145,10 +148,10 @@ syscallenter(struct thread *td)
AUDIT_SYSCALL_ENTER(sa->code, td))) {
#ifdef KDTRACE_HOOKS
/* Give the syscall:::entry DTrace probe a chance to fire. */
- if (__predict_false(sa->callp->sy_entry != 0))
+ if (__predict_false(se->sy_entry != 0))
(*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0);
#endif
- error = (sa->callp->sy_call)(td, sa->args);
+ error = (se->sy_call)(td, sa->args);
/* Save the latest error return value. */
if (__predict_false((td->td_pflags & TDP_NERRNO) != 0))
td->td_pflags &= ~TDP_NERRNO;
@@ -168,19 +171,19 @@ syscallenter(struct thread *td)
#ifdef KDTRACE_HOOKS
/* Give the syscall:::return DTrace probe a chance to fire. */
- if (__predict_false(sa->callp->sy_return != 0))
+ if (__predict_false(se->sy_return != 0))
(*systrace_probe_func)(sa, SYSTRACE_RETURN,
error ? -1 : td->td_retval[0]);
#endif
} else {
- error = (sa->callp->sy_call)(td, sa->args);
+ error = (se->sy_call)(td, sa->args);
/* Save the latest error return value. */
if (__predict_false((td->td_pflags & TDP_NERRNO) != 0))
td->td_pflags &= ~TDP_NERRNO;
else
td->td_errno = error;
}
- syscall_thread_exit(td, sa->callp);
+ syscall_thread_exit(td, se);
retval:
KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code),