Date: Mon, 27 Apr 2020 20:37:11 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360392 - in stable/12/sys: amd64/amd64 amd64/ia32 arm/arm arm64/arm64 i386/i386 kern mips/mips powerpc/powerpc riscv/riscv sparc64/sparc64 Message-ID: <202004272037.03RKbB5d052513@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Apr 27 20:37:11 2020 New Revision: 360392 URL: https://svnweb.freebsd.org/changeset/base/360392 Log: MFC 350013: 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. Modified: stable/12/sys/amd64/amd64/trap.c stable/12/sys/amd64/ia32/ia32_syscall.c stable/12/sys/arm/arm/syscall.c stable/12/sys/arm64/arm64/trap.c stable/12/sys/i386/i386/trap.c stable/12/sys/kern/subr_syscall.c stable/12/sys/mips/mips/trap.c stable/12/sys/powerpc/powerpc/trap.c stable/12/sys/riscv/riscv/trap.c stable/12/sys/sparc64/sparc64/trap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/trap.c ============================================================================== --- stable/12/sys/amd64/amd64/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/amd64/amd64/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -1156,7 +1156,6 @@ SYSCTL_PROC(_machdep, OID_AUTO, syscall_ret_flush_l1d, void amd64_syscall(struct thread *td, int traced) { - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1165,7 +1164,7 @@ amd64_syscall(struct thread *td, int traced) /* NOT REACHED */ } #endif - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1190,7 +1189,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 @@ -1203,5 +1202,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); } Modified: stable/12/sys/amd64/ia32/ia32_syscall.c ============================================================================== --- stable/12/sys/amd64/ia32/ia32_syscall.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/amd64/ia32/ia32_syscall.c Mon Apr 27 20:37:11 2020 (r360392) @@ -209,14 +209,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. @@ -230,8 +229,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 Modified: stable/12/sys/arm/arm/syscall.c ============================================================================== --- stable/12/sys/arm/arm/syscall.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/arm/arm/syscall.c Mon Apr 27 20:37:11 2020 (r360392) @@ -143,14 +143,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 Modified: stable/12/sys/arm64/arm64/trap.c ============================================================================== --- stable/12/sys/arm64/arm64/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/arm64/arm64/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -138,11 +138,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); Modified: stable/12/sys/i386/i386/trap.c ============================================================================== --- stable/12/sys/i386/i386/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/i386/i386/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -1127,7 +1127,6 @@ syscall(struct trapframe *frame) { struct thread *td; register_t orig_tf_eflags; - int error; ksiginfo_t ksi; #ifdef DIAGNOSTIC @@ -1142,7 +1141,7 @@ syscall(struct trapframe *frame) td = curthread; td->td_frame = frame; - error = syscallenter(td); + syscallenter(td); /* * Traced syscall. @@ -1163,5 +1162,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); } Modified: stable/12/sys/kern/subr_syscall.c ============================================================================== --- stable/12/sys/kern/subr_syscall.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/kern/subr_syscall.c Mon Apr 27 20:37:11 2020 (r360392) @@ -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, *p2; struct syscall_args *sa; Modified: stable/12/sys/mips/mips/trap.c ============================================================================== --- stable/12/sys/mips/mips/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/mips/mips/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -785,10 +785,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) @@ -804,7 +802,7 @@ dofault: * instead of being done here under a special check * for SYS_ptrace(). */ - syscallret(td, error); + syscallret(td); return (trapframe->pc); } Modified: stable/12/sys/powerpc/powerpc/trap.c ============================================================================== --- stable/12/sys/powerpc/powerpc/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/powerpc/powerpc/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -661,7 +661,6 @@ void syscall(struct trapframe *frame) { struct thread *td; - int error; td = curthread; td->td_frame = frame; @@ -676,8 +675,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); } #if defined(__powerpc64__) && defined(AIM) Modified: stable/12/sys/riscv/riscv/trap.c ============================================================================== --- stable/12/sys/riscv/riscv/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/riscv/riscv/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -157,13 +157,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 Modified: stable/12/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/12/sys/sparc64/sparc64/trap.c Mon Apr 27 19:49:35 2020 (r360391) +++ stable/12/sys/sparc64/sparc64/trap.c Mon Apr 27 20:37:11 2020 (r360392) @@ -597,7 +597,6 @@ void syscall(struct trapframe *tf) { struct thread *td; - int error; td = curthread; td->td_frame = tf; @@ -612,6 +611,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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004272037.03RKbB5d052513>