summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-12 07:37:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2023-12-12 07:37:22 +0000
commite844bfa2c53c6f4ad0c2d3eb7c473792a367387c (patch)
treecc6908934a7cfbe223a13ea717dba9ef16fd50bc /sys/arch
parent568684ccff4377f0c3ebfeb53d963c498211bb0f (diff)
The sigtramp was calling sigreturn(2), and upon failure exit(2), which
doesn't make sense anymore. It is better to just issue an illegal instruction. ok kettenis, with some misgivings about inconsistant approaches between architectures. In the future we could change sigreturn(2) to never return an exit code, but always just terminate the process. We stopped this system call from being callable ages ago with msyscall(2), and there is no stub for it in libc.. maybe that's the next step to take?
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/locore.S7
-rw-r--r--sys/arch/arm/arm/sigcode.S9
-rw-r--r--sys/arch/arm64/arm64/locore.S10
-rw-r--r--sys/arch/hppa/hppa/locore.S11
-rw-r--r--sys/arch/i386/i386/locore.s6
-rw-r--r--sys/arch/m88k/m88k/subr.S12
-rw-r--r--sys/arch/macppc/macppc/locore.S6
-rw-r--r--sys/arch/mips64/mips64/lcore_access.S6
-rw-r--r--sys/arch/powerpc64/powerpc64/locore.S6
-rw-r--r--sys/arch/riscv64/riscv64/locore.S24
-rw-r--r--sys/arch/sh/sh/locore_subr.S8
-rw-r--r--sys/arch/sparc64/sparc64/locore.s6
12 files changed, 35 insertions, 76 deletions
diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S
index a3d496e44e1..b36ab19d853 100644
--- a/sys/arch/amd64/amd64/locore.S
+++ b/sys/arch/amd64/amd64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.142 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.143 2023/12/12 07:37:20 deraadt Exp $ */
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
/*
@@ -181,13 +181,10 @@ sigcodecall:
syscall
.globl sigcoderet
sigcoderet:
- movq $SYS_exit,%rax
- syscall
- _ALIGN_TRAPS
+ int3
1: JMP_RETPOLINE(rax)
.globl esigcode
esigcode:
-
.globl sigfill
sigfill:
int3
diff --git a/sys/arch/arm/arm/sigcode.S b/sys/arch/arm/arm/sigcode.S
index 70c0f54750e..b2402d8c1a1 100644
--- a/sys/arch/arm/arm/sigcode.S
+++ b/sys/arch/arm/arm/sigcode.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigcode.S,v 1.13 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: sigcode.S,v 1.14 2023/12/12 07:37:20 deraadt Exp $ */
/* $NetBSD: sigcode.S,v 1.6 2003/10/05 19:44:58 matt Exp $ */
/*
@@ -63,14 +63,9 @@ sigcodecall:
isb
.globl sigcoderet
sigcoderet:
- /* Well if that failed we better exit quick ! */
- mov r12, #SYS_exit
- swi 0
- dsb nsh
- isb
.global esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
udf #0
diff --git a/sys/arch/arm64/arm64/locore.S b/sys/arch/arm64/arm64/locore.S
index 9f2faa0d213..771e7eff786 100644
--- a/sys/arch/arm64/arm64/locore.S
+++ b/sys/arch/arm64/arm64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.44 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.45 2023/12/12 07:37:20 deraadt Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
@@ -372,16 +372,10 @@ sigcodecall:
isb
.globl sigcoderet
sigcoderet:
-
- /* sigreturn failed, exit */
- mov x8, #SYS_exit
- svc 0
- dsb nsh
- isb
END(sigcode)
.global esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
udf #0
diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S
index 28647e5f426..3c952c8bf1d 100644
--- a/sys/arch/hppa/hppa/locore.S
+++ b/sys/arch/hppa/hppa/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.206 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.207 2023/12/12 07:37:20 deraadt Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -2872,15 +2872,10 @@ sigcodecall:
ldi SYS_sigreturn, t1
.globl sigcoderet
sigcoderet:
-
- ldil L%SYSCALLGATE, r1
- copy ret0, arg0
- .call
- ble 4(sr7, r1)
- ldi SYS_exit, t1
+ break 0,0
ALTENTRY(esigcode)
-EXIT(sigcode)
+EXIT(sigcode)
.globl sigfill
sigfill:
break 0,0
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index c3a749702a3..b25acfaab5c 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.203 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.204 2023/12/12 07:37:20 deraadt Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -346,11 +346,9 @@ sigcodecall:
int $0x80 # enter kernel with args on stack
.globl sigcoderet
sigcoderet:
- movl $SYS_exit,%eax
- int $0x80 # exit if sigreturn fails
.globl esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
int3
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index 69d79fe859d..ff73eec1553 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.30 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: subr.S,v 1.31 2023/12/12 07:37:21 deraadt Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -1138,16 +1138,8 @@ GLOBAL(sigcoderet)
#ifdef dontbother /* sigreturn will not return unless it fails */
NOP | success return
#endif
- or %r13, %r0, SYS_exit
- tb0 0, %r0, 450 /* syscall trap, exit */
- /*
- * this never returns, but we need to provide fetchable instructions
- * for the 88100 pipeline.
- */
- NOP
- NOP
GLOBAL(esigcode)
-
+ /* FALLTHROUGH */
GLOBAL(sigfill)
tb0 0, %r0, 130 /* breakpoint */
GLOBAL(sigfillsiz)
diff --git a/sys/arch/macppc/macppc/locore.S b/sys/arch/macppc/macppc/locore.S
index 76ed02fcee5..d1c59bf5979 100644
--- a/sys/arch/macppc/macppc/locore.S
+++ b/sys/arch/macppc/macppc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.63 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.64 2023/12/12 07:37:21 deraadt Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -1180,10 +1180,8 @@ sigcodecall:
sc /* sigreturn(scp) */
.globl sigcoderet
sigcoderet:
- li %r0,SYS_exit
- sc /* exit(errno) */
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
.long 0 # illegal
diff --git a/sys/arch/mips64/mips64/lcore_access.S b/sys/arch/mips64/mips64/lcore_access.S
index f2106d14ef3..1aeb6c26fa8 100644
--- a/sys/arch/mips64/mips64/lcore_access.S
+++ b/sys/arch/mips64/mips64/lcore_access.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcore_access.S,v 1.35 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: lcore_access.S,v 1.36 2023/12/12 07:37:21 deraadt Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -80,11 +80,9 @@ sigcodecall:
syscall
.globl sigcoderet
sigcoderet:
- LI v0, SYS_exit # just in case sigreturn fails
- syscall
.globl esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
teq zero, zero, 0x52
diff --git a/sys/arch/powerpc64/powerpc64/locore.S b/sys/arch/powerpc64/powerpc64/locore.S
index c74b185651c..59c5cb5d2f8 100644
--- a/sys/arch/powerpc64/powerpc64/locore.S
+++ b/sys/arch/powerpc64/powerpc64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.47 2023/12/10 16:56:01 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.48 2023/12/12 07:37:21 deraadt Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -42,11 +42,9 @@ sigcodecall:
sc
.globl sigcoderet
sigcoderet:
- li %r0, SYS_exit
- sc
.globl esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
.long 0
diff --git a/sys/arch/riscv64/riscv64/locore.S b/sys/arch/riscv64/riscv64/locore.S
index f1f1f2e8be7..f7c3f0f01c5 100644
--- a/sys/arch/riscv64/riscv64/locore.S
+++ b/sys/arch/riscv64/riscv64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.16 2023/12/10 16:56:02 deraadt Exp $ */
+/* $OpenBSD: locore.S,v 1.17 2023/12/12 07:37:21 deraadt Exp $ */
/*-
* Copyright (c) 2015-2018 Ruslan Bukin <br@bsdpad.com>
@@ -236,15 +236,6 @@ initstack:
.space USPACE
initstack_end:
- .globl sigfill
-sigfill:
- unimp
-esigfill:
- .globl sigfillsiz
-sigfillsiz:
- .data
- .word esigfill - sigfill
-
.text
ENTRY(sigcode)
mv a0, sp
@@ -255,13 +246,20 @@ sigcodecall:
ecall
.globl sigcoderet
sigcoderet:
- /* sigreturn failed, exit */
- li t0, SYS_exit
- ecall
+ unimp
END(sigcode)
.globl esigcode
esigcode:
+ .globl sigfill
+sigfill:
+ unimp
+esigfill:
+ .globl sigfillsiz
+sigfillsiz:
+ .data
+ .word esigfill - sigfill
+
.data
.global esym
esym:
diff --git a/sys/arch/sh/sh/locore_subr.S b/sys/arch/sh/sh/locore_subr.S
index 2bd371ff887..944d1d2372e 100644
--- a/sys/arch/sh/sh/locore_subr.S
+++ b/sys/arch/sh/sh/locore_subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_subr.S,v 1.18 2023/12/10 16:56:02 deraadt Exp $ */
+/* $OpenBSD: locore_subr.S,v 1.19 2023/12/12 07:37:21 deraadt Exp $ */
/* $NetBSD: locore_subr.S,v 1.28 2006/01/23 22:52:09 uwe Exp $ */
/*
@@ -45,7 +45,7 @@
#include "assym.h"
-#include <sys/syscall.h> /* SYS_sigreturn, SYS_exit */
+#include <sys/syscall.h> /* SYS_sigreturn */
#include <sh/asm.h>
#include <sh/locore.h>
#include <sh/param.h> /* UPAGES */
@@ -502,13 +502,11 @@ sigcodecall:
trapa #0x80 /* and call sigreturn() */
.globl sigcoderet
sigcoderet:
- mov.l .L_SYS_exit, r0
- trapa #0x80 /* exit if sigreturn fails */
+ sleep /* privileged -> illegal? */
/* NOTREACHED */
.align 2
.L_SYS_sigreturn: .long SYS_sigreturn
-.L_SYS_exit: .long SYS_exit
/* LINTSTUB: Var: char esigcode[1] */
.globl esigcode
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 786bb4a7ace..a92c987562d 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.203 2023/12/10 16:56:02 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.204 2023/12/12 07:37:21 deraadt Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -5403,11 +5403,9 @@ sigcoderet:
sigcodecall:
t ST_SYSCALL ! sigreturn(scp)
! sigreturn does not return unless it fails
- mov SYS_exit, %g1 ! exit(errno)
- t ST_SYSCALL
.globl esigcode
esigcode:
-
+ /* FALLTHROUGH */
.globl sigfill
sigfill:
unimp