Properly handle userland branch target traps.
authorkettenis <kettenis@openbsd.org>
Wed, 26 Apr 2023 12:30:24 +0000 (12:30 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 26 Apr 2023 12:30:24 +0000 (12:30 +0000)
ok deraadt@, patrick@

sys/arch/arm64/arm64/trap.c

index 7f4f37e..78d1857 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.43 2023/03/27 19:02:47 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.44 2023/04/26 12:30:24 kettenis Exp $ */
 /*-
  * Copyright (c) 2014 Andrew Turner
  * All rights reserved.
@@ -281,6 +281,11 @@ do_el0_sync(struct trapframe *frame)
        case EXCP_TRAP_FP:
                fpu_load(p);
                break;
+       case EXCP_BRANCH_TGT:
+               curcpu()->ci_flush_bp();
+               sv.sival_ptr = (void *)frame->tf_elr;
+               trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
+               break;
        case EXCP_SVC:
                svc_handler(frame);
                break;