diff options
author | John Baldwin <jhb@FreeBSD.org> | 2019-07-15 21:25:16 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2019-07-15 21:25:16 +0000 |
commit | c18ca749162a8524ea5b3a6ada0b1e94a46fb81a (patch) | |
tree | 59dd610a980058fc04e326e04cf459792d77d915 | |
parent | 1af9474b2608696269c52a7dd77c54c9fae615d9 (diff) | |
download | src-c18ca749162a8524ea5b3a6ada0b1e94a46fb81a.tar.gz src-c18ca749162a8524ea5b3a6ada0b1e94a46fb81a.zip |
Don't pass error from syscallenter() to syscallret().
syscallret() doesn't use error anymore. Fix a few other places to permit
removing the return value from syscallenter() entirely.
- Remove a duplicated assertion from arm's syscall().
- Use td_errno for amd64_syscall_ret_flush_l1d.
Reviewed by: kib
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D2090
Notes
Notes:
svn path=/head/; revision=350013
-rw-r--r-- | sys/amd64/amd64/trap.c | 7 | ||||
-rw-r--r-- | sys/amd64/ia32/ia32_syscall.c | 7 | ||||
-rw-r--r-- | sys/arm/arm/syscall.c | 8 | ||||
-rw-r--r-- | sys/arm64/arm64/trap.c | 5 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 5 | ||||
-rw-r--r-- | sys/kern/subr_syscall.c | 5 | ||||
-rw-r--r-- | sys/mips/mips/trap.c | 6 | ||||
-rw-r--r-- | sys/powerpc/powerpc/trap.c | 5 | ||||
-rw-r--r-- | sys/riscv/riscv/trap.c | 5 | ||||
-rw-r--r-- | sys/sparc64/sparc64/trap.c | 5 |
10 files changed, 22 insertions, 36 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 3bdb01ecfc05..39e7288269d1 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1169,7 +1169,6 @@ SYSCTL_PROC(_machdep, OID_AUTO, syscall_ret_flush_l1d, CTLTYPE_INT | void amd64_syscall(struct thread *td, int traced) { - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1178,7 +1177,7 @@ amd64_syscall(struct thread *td, int traced) /* NOT REACHED */ } #endif - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1203,7 +1202,7 @@ amd64_syscall(struct thread *td, int traced) syscallname(td->td_proc, td->td_sa.code), td->td_md.md_invl_gen.gen)); - syscallret(td, error); + syscallret(td); /* * If the user-supplied value of %rip is not a canonical @@ -1216,5 +1215,5 @@ amd64_syscall(struct thread *td, int traced) if (__predict_false(td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS)) set_pcb_flags(td->td_pcb, PCB_FULL_IRET); - amd64_syscall_ret_flush_l1d_inline(error); + amd64_syscall_ret_flush_l1d_inline(td->td_errno); } diff --git a/sys/amd64/ia32/ia32_syscall.c b/sys/amd64/ia32/ia32_syscall.c index 0b0ba742eb3f..1bce6ad26513 100644 --- a/sys/amd64/ia32/ia32_syscall.c +++ b/sys/amd64/ia32/ia32_syscall.c @@ -207,14 +207,13 @@ ia32_syscall(struct trapframe *frame) { struct thread *td; register_t orig_tf_rflags; - int error; ksiginfo_t ksi; orig_tf_rflags = frame->tf_rflags; td = curthread; td->td_frame = frame; - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -228,8 +227,8 @@ ia32_syscall(struct trapframe *frame) trapsignal(td, &ksi); } - syscallret(td, error); - amd64_syscall_ret_flush_l1d(error); + syscallret(td); + amd64_syscall_ret_flush_l1d(td->td_errno); } static void diff --git a/sys/arm/arm/syscall.c b/sys/arm/arm/syscall.c index 21a88e9c6c69..2500404d01f5 100644 --- a/sys/arm/arm/syscall.c +++ b/sys/arm/arm/syscall.c @@ -141,14 +141,10 @@ cpu_fetch_syscall_args(struct thread *td) static void syscall(struct thread *td, struct trapframe *frame) { - int error; td->td_sa.nap = 4; - - error = syscallenter(td); - KASSERT(error != 0 || td->td_ar == NULL, - ("returning from syscall with td_ar set!")); - syscallret(td, error); + syscallenter(td); + syscallret(td); } void diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 526957156429..e2b7b16a4c37 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -137,11 +137,10 @@ cpu_fetch_syscall_args(struct thread *td) static void svc_handler(struct thread *td, struct trapframe *frame) { - int error; if ((frame->tf_esr & ESR_ELx_ISS_MASK) == 0) { - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } else { call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr); userret(td, frame); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index b27e10e8a23b..9d0b128dc295 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1142,7 +1142,6 @@ syscall(struct trapframe *frame) { struct thread *td; register_t orig_tf_eflags; - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1157,7 +1156,7 @@ syscall(struct trapframe *frame) td = curthread; td->td_frame = frame; - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1178,5 +1177,5 @@ syscall(struct trapframe *frame) ("System call %s returning with mangled pcb_save", syscallname(td->td_proc, td->td_sa.code))); - syscallret(td, error); + syscallret(td); } diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index b15cc6dea330..951e7b682623 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #endif #include <security/audit/audit.h> -static inline int +static inline void syscallenter(struct thread *td) { struct proc *p; @@ -167,11 +167,10 @@ syscallenter(struct thread *td) PROC_UNLOCK(p); } (p->p_sysent->sv_set_syscall_retval)(td, error); - return (error); } static inline void -syscallret(struct thread *td, int error __unused) +syscallret(struct thread *td) { struct proc *p; struct syscall_args *sa; diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index 65a950624b26..68057014bdde 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -787,10 +787,8 @@ dofault: case T_SYSCALL + T_USER: { - int error; - td->td_sa.trapframe = trapframe; - error = syscallenter(td); + syscallenter(td); #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) if (trp == trapdebug) @@ -806,7 +804,7 @@ dofault: * instead of being done here under a special check * for SYS_ptrace(). */ - syscallret(td, error); + syscallret(td); return (trapframe->pc); } diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c index 3cc04fbc75ad..143811eedf97 100644 --- a/sys/powerpc/powerpc/trap.c +++ b/sys/powerpc/powerpc/trap.c @@ -700,7 +700,6 @@ void syscall(struct trapframe *frame) { struct thread *td; - int error; td = curthread; td->td_frame = frame; @@ -715,8 +714,8 @@ syscall(struct trapframe *frame) "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE)); #endif - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } static int diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 310edcc30858..85453a751f2d 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -156,13 +156,12 @@ static void svc_handler(struct trapframe *frame) { struct thread *td; - int error; td = curthread; td->td_frame = frame; - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } static void diff --git a/sys/sparc64/sparc64/trap.c b/sys/sparc64/sparc64/trap.c index 81c48b7699fd..9038956ccce3 100644 --- a/sys/sparc64/sparc64/trap.c +++ b/sys/sparc64/sparc64/trap.c @@ -593,7 +593,6 @@ void syscall(struct trapframe *tf) { struct thread *td; - int error; td = curthread; td->td_frame = tf; @@ -608,6 +607,6 @@ syscall(struct trapframe *tf) td->td_pcb->pcb_tpc = tf->tf_tpc; TF_DONE(tf); - error = syscallenter(td); - syscallret(td, error); + syscallenter(td); + syscallret(td); } |