summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2018-06-22 16:08:12 +0000
committerdrahn <drahn@openbsd.org>2018-06-22 16:08:12 +0000
commit23d8ed08c810810932e605ed24b9cbe3d342b345 (patch)
treebb00924b18b55b174bc247f501ec83982daa3c37 /sys
parentset I2C_F_POLL when acquiring the iic bus in an interrupt handler (diff)
downloadwireguard-openbsd-23d8ed08c810810932e605ed24b9cbe3d342b345.tar.xz
wireguard-openbsd-23d8ed08c810810932e605ed24b9cbe3d342b345.zip
Updating md_astpending in ast() creates a race, update the variable in asm
before calling ast(). Pointed out by Gunther after I had a fix. ok guenther@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/arm64/ast.c4
-rw-r--r--sys/arch/arm64/arm64/exception.S9
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/arm64/arm64/ast.c b/sys/arch/arm64/arm64/ast.c
index 57f6b0c3f3f..2479eb52e9e 100644
--- a/sys/arch/arm64/arm64/ast.c
+++ b/sys/arch/arm64/arm64/ast.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ast.c,v 1.6 2018/06/22 15:33:33 kettenis Exp $ */
+/* $OpenBSD: ast.c,v 1.7 2018/06/22 16:08:12 drahn Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
@@ -39,8 +39,6 @@ ast(struct trapframe *tf)
{
struct proc *p = curcpu()->ci_curproc;
- p->p_md.md_astpending = 0;
-
p->p_addr->u_pcb.pcb_tf = tf;
refreshcreds(p);
diff --git a/sys/arch/arm64/arm64/exception.S b/sys/arch/arm64/arm64/exception.S
index 6220f9a6b7b..41a58543d66 100644
--- a/sys/arch/arm64/arm64/exception.S
+++ b/sys/arch/arm64/arm64/exception.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: exception.S,v 1.5 2018/01/10 23:27:18 kettenis Exp $ */
+/* $OpenBSD: exception.S,v 1.6 2018/06/22 16:08:12 drahn Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
* All rights reserved.
@@ -125,8 +125,11 @@ __FBSDID("$FreeBSD: head/sys/arm64/arm64/exception.S 297028 2016-03-18 16:18:29Z
mrs x18, tpidr_el1
ldr x1, [x18, #CI_CURPROC]
cbz x1, 2f
- ldr w1, [x1, #P_ASTPENDING]
- cbz w1, 2f
+ ldr w2, [x1, #P_ASTPENDING]
+ cbz w2, 2f
+
+ // clear astpending before enabling interrupts.
+ str wzr, [x1, #P_ASTPENDING]
/* Restore interrupts */
msr daif, x19