diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-12-12 15:30:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-12-12 15:30:57 +0000 |
commit | 8c7460c9897521d5f816ac3fda78a94555c9b9b8 (patch) | |
tree | a76554430df0c1549d7f9a58111ca1376d678b61 /sys/arch/alpha | |
parent | d88a737e6a2d8df255f5eb84d88fdb69f559a924 (diff) |
remove support for syscall(2) -- the "indirection system call" because
it is a dangerous alternative entry point for all system calls, and thus
incompatible with the precision system call entry point scheme we are
heading towards. This has been a 3-year mission:
First perl needed a code-generated wrapper to fake syscall(2) as a giant
switch table, then all the ports were cleaned with relatively minor fixes,
except for "go". "go" required two fixes -- 1) a framework issue with
old library versions, and 2) like perl, a fake syscall(2) wrapper to
handle ioctl(2) and sysctl(2) because "syscall(SYS_ioctl" occurs all over
the place in the "go" ecosystem because the "go developers" are plan9-loving
unix-hating folk who tried to build an ecosystem without allowing "ioctl".
ok kettenis, jsing, afresh1, sthen
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r-- | sys/arch/alpha/alpha/trap.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c index abe69405852..fc697aadf41 100644 --- a/sys/arch/alpha/alpha/trap.c +++ b/sys/arch/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.108 2023/03/08 04:43:07 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.109 2023/12/12 15:30:55 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */ /*- @@ -497,17 +497,15 @@ dopanic: * a3, and v0 from the frame before returning to the user process. */ void -syscall(code, framep) - u_int64_t code; - struct trapframe *framep; +syscall(u_int64_t code, struct trapframe *framep) { - const struct sysent *callp; + const struct sysent *callp = sysent; struct proc *p; - int error, indirect = -1; + int error; u_int64_t opc; u_long rval[2]; u_long args[10]; /* XXX */ - u_int hidden, nargs; + u_int nargs; atomic_add_int(&uvmexp.syscalls, 1); p = curproc; @@ -515,24 +513,11 @@ syscall(code, framep) framep->tf_regs[FRAME_SP] = alpha_pal_rdusp(); opc = framep->tf_regs[FRAME_PC] - 4; - switch(code) { - case SYS_syscall: - indirect = code; - code = framep->tf_regs[FRAME_A0]; - hidden = 1; - break; - default: - hidden = 0; - } - - error = 0; - callp = sysent; - if (code >= SYS_MAXSYSCALL) - callp += SYS_syscall; - else + // XXX out of range stays on syscall0, which we assume is enosys + if (code >= 0 || code <= SYS_MAXSYSCALL) callp += code; - nargs = callp->sy_narg + hidden; + nargs = callp->sy_narg; switch (nargs) { default: if (nargs > 10) /* XXX */ @@ -559,7 +544,7 @@ syscall(code, framep) rval[0] = 0; rval[1] = 0; - error = mi_syscall(p, code, indirect, callp, args + hidden, rval); + error = mi_syscall(p, code, callp, args, rval); switch (error) { case 0: |