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
This commit is contained in:
parent
1af9474b26
commit
c18ca74916
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user