From: deraadt Date: Wed, 21 Feb 2024 15:53:07 +0000 (+0000) Subject: create a new code ILL_BTCFI associated with SIGILL for trap faults which X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=88580652a3669007813512ab28f5ee7ceeae4a78;p=openbsd create a new code ILL_BTCFI associated with SIGILL for trap faults which indicate missing indirect branch target instructions (on the two architectures which currently have this). This becomes nicely visible in kdump: 6526 cat PSIG SIGILL SIG_DFL code=ILL_BTCFI addr=0x438fad6a990 trapno=21 ok kettenis sthen miod rsadowski --- diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index 4df17486b78..a40de920271 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.104 2024/01/31 06:06:28 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.105 2024/02/21 15:53:07 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */ /*- @@ -424,7 +424,7 @@ usertrap(struct trapframe *frame) break; case T_CP: sig = SIGILL; - code = (frame->tf_err & 0x7fff) < 4 ? ILL_ILLOPC + code = (frame->tf_err & 0x7fff) < 4 ? ILL_BTCFI : ILL_BADSTK; break; diff --git a/sys/arch/arm64/arm64/trap.c b/sys/arch/arm64/arm64/trap.c index bbe6b04c538..c420b747768 100644 --- a/sys/arch/arm64/arm64/trap.c +++ b/sys/arch/arm64/arm64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.47 2023/12/26 09:19:15 kettenis Exp $ */ +/* $OpenBSD: trap.c,v 1.48 2024/02/21 15:53:07 deraadt Exp $ */ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. @@ -286,7 +286,7 @@ do_el0_sync(struct trapframe *frame) case EXCP_BRANCH_TGT: curcpu()->ci_flush_bp(); sv.sival_ptr = (void *)frame->tf_elr; - trapsignal(p, SIGILL, esr, ILL_ILLOPC, sv); + trapsignal(p, SIGILL, esr, ILL_BTCFI, sv); break; case EXCP_FPAC: curcpu()->ci_flush_bp(); diff --git a/sys/sys/siginfo.h b/sys/sys/siginfo.h index c534ab10474..d071f4fe5ea 100644 --- a/sys/sys/siginfo.h +++ b/sys/sys/siginfo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo.h,v 1.13 2022/10/25 16:08:26 kettenis Exp $ */ +/* $OpenBSD: siginfo.h,v 1.14 2024/02/21 15:53:07 deraadt Exp $ */ /* * Copyright (c) 1997 Theo de Raadt @@ -61,7 +61,8 @@ union sigval { #define ILL_PRVREG 6 /* privileged register */ #define ILL_COPROC 7 /* co-processor */ #define ILL_BADSTK 8 /* bad stack */ -#define NSIGILL 8 +#define ILL_BTCFI 9 /* IBT missing on indirect call */ +#define NSIGILL 9 #define EMT_TAGOVF 1 /* tag overflow */ #define NSIGEMT 1