summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-05-23 07:18:51 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-05-23 07:18:51 +0000
commit2586781472be8e17c09c2e6c04527803b2c11d86 (patch)
treeb96d27f59884d831f8f04b2420375abd6390733d /sys/arch/mips64
parent907992fd6b4d5d69123ddcc06c9aa16bd0d5db10 (diff)
Use a distinct trap code with retguard on mips64.
This lets the kernel detect retguard traps and send SIGABRT instead of SIGEMT. SIGEMT does not indicate correctly the nature of the error (stack overflow, violation of control flow). It can confuse the user to restart the program without further investigation. Prompted by and OK deraadt@ OK mortimer@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r--sys/arch/mips64/mips64/trap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 2945e37312b..87d390978cf 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.144 2020/04/18 04:45:20 visa Exp $ */
+/* $OpenBSD: trap.c,v 1.145 2020/05/23 07:18:50 visa Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -763,6 +763,14 @@ fault_common_no_miss:
(instr & 0x001fffc0) == ((ZERO << 16) | (7 << 6))) {
signal = SIGFPE;
sicode = FPE_INTDIV;
+ } else if ((instr & 0xfc00003f) == 0x00000036 /* tne */ &&
+ (instr & 0x0000ffc0) == (0x52 << 6)) {
+ KERNEL_LOCK();
+ log(LOG_ERR, "%s[%d]: retguard trap\n",
+ p->p_p->ps_comm, p->p_p->ps_pid);
+ /* Send uncatchable SIGABRT for coredump */
+ sigexit(p, SIGABRT);
+ /* NOTREACHED */
} else {
signal = SIGEMT; /* Stuff it with something for now */
sicode = 0;