summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-02-18 12:19:12 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-02-18 12:19:12 +0000
commitabaeee0c2de5db354ea200288f678a16ca5ea4bb (patch)
tree470771504e5b18405e7e6725c6b9836a6e05d677 /libexec
parent7d507c040f5f8f249c657a3d207a3bf7bdc53eec (diff)
Now that the kernel skips the two instructions immediately following
a syscall, replace the double nop with a dsb nsh; isb; sequence which stops the CPU from speculating any further. This fix was suggested by Anthony Steinhauser. ok deraadt@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/aarch64/SYS.h6
-rw-r--r--libexec/ld.so/aarch64/rtld_machine.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/libexec/ld.so/aarch64/SYS.h b/libexec/ld.so/aarch64/SYS.h
index 46ed6aca5c0..08ec2a7b300 100644
--- a/libexec/ld.so/aarch64/SYS.h
+++ b/libexec/ld.so/aarch64/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.4 2020/01/26 02:19:44 kettenis Exp $ */
+/* $OpenBSD: SYS.h,v 1.5 2020/02/18 12:19:11 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn
@@ -32,8 +32,8 @@
#define SYSTRAP(x) \
ldr x8, =SYS_ ## x ;\
svc 0 ;\
- nop ;\
- nop
+ dsb nsh ;\
+ isb
#define DL_SYSCALL(n) \
.global __CONCAT(_dl_,n) ;\
diff --git a/libexec/ld.so/aarch64/rtld_machine.c b/libexec/ld.so/aarch64/rtld_machine.c
index d466b5a1776..eac2a0cd124 100644
--- a/libexec/ld.so/aarch64/rtld_machine.c
+++ b/libexec/ld.so/aarch64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.19 2020/01/26 02:19:44 kettenis Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.20 2020/02/18 12:19:11 kettenis Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -300,7 +300,7 @@ _dl_bind(elf_object_t *object, int relidx)
register long arg2 __asm("x1") = sizeof(buf);
register long arg3 __asm("x2") = cookie;
- __asm volatile("svc 0; nop; nop" : "+r" (arg1), "+r" (arg2)
+ __asm volatile("svc 0; dsb nsh; isb" : "+r" (arg1), "+r" (arg2)
: "r" (syscall_num), "r" (arg3)
: "cc", "memory");
}