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/powerpc | |
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/powerpc')
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 94ec7ccf281..bd20eb437b2 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.131 2023/02/11 23:07:27 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.132 2023/12/12 15:30:56 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -239,11 +239,11 @@ trap(struct trapframe *frame) struct vm_map *map; vaddr_t va; int access_type; - const struct sysent *callp; + const struct sysent *callp = sysent; size_t argsize; register_t code, error; register_t *params, rval[2], args[10]; - int n, indirect = -1; + int n; if (frame->srr1 & PSL_PR) { type |= EXC_USER; @@ -360,27 +360,13 @@ trap(struct trapframe *frame) case EXC_SC|EXC_USER: uvmexp.syscalls++; - code = frame->fixreg[0]; params = frame->fixreg + FIRSTARG; - switch (code) { - case SYS_syscall: - /* - * code is first argument, - * followed by actual args. - */ - indirect = code; - code = *params++; - break; - default: - break; - } + code = frame->fixreg[0]; + // XXX out of range stays on syscall0, which we assume is enosys + if (code >= 0 || code <= SYS_MAXSYSCALL) + callp += code; - callp = sysent; - if (code < 0 || code >= SYS_MAXSYSCALL) - callp += SYS_syscall; - else - callp += code; argsize = callp->sy_argsize; n = NARGREG - (params - (frame->fixreg + FIRSTARG)); if (argsize > n * sizeof(register_t)) { @@ -395,7 +381,7 @@ trap(struct trapframe *frame) rval[0] = 0; rval[1] = frame->fixreg[FIRSTARG + 1]; - error = mi_syscall(p, code, indirect, callp, params, rval); + error = mi_syscall(p, code, callp, params, rval); switch (error) { case 0: |