From: kettenis Date: Mon, 24 Apr 2023 10:22:48 +0000 (+0000) Subject: Enable branch target control flow enforcement on arm64. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=88d0d93d60e314d78e0c9ecdbab1a3b845a8baf7;p=openbsd Enable branch target control flow enforcement on arm64. ok robert@, deraadt@ --- diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c index ff7886b9db7..20ad76d57c6 100644 --- a/sys/arch/arm64/arm64/machdep.c +++ b/sys/arch/arm64/arm64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.80 2023/03/30 15:09:01 kn Exp $ */ +/* $OpenBSD: machdep.c,v 1.81 2023/04/24 10:22:48 kettenis Exp $ */ /* * Copyright (c) 2014 Patrick Wildt * Copyright (c) 2021 Mark Kettenis @@ -454,6 +454,11 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, struct pcb *pcb = &p->p_addr->u_pcb; struct trapframe *tf = pcb->pcb_tf; + if (pack->ep_flags & EXEC_NOBTCFI) + p->p_vmspace->vm_map.pmap->pm_guarded = 0; + else + p->p_vmspace->vm_map.pmap->pm_guarded = ATTR_GP; + /* If we were using the FPU, forget about it. */ memset(&pcb->pcb_fpstate, 0, sizeof(pcb->pcb_fpstate)); pcb->pcb_flags &= ~PCB_FPU;