summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-01-26 02:19:45 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-01-26 02:19:45 +0000
commit0ec8c6b435bb55fc0772bb3076380d3ce30b2c72 (patch)
tree1d775542b140394e8c53b525297c68d12d3e6a0f /libexec/ld.so
parent675d8462e190fecce5396b0b9c999a26ab2246b1 (diff)
Insert two nop instructions after each svc #0 instruction in userland.
The will be replaced by a speculation barrier as soon as we teach the kernel to skip over these two instructions when returning from a system call. ok patrick@, deraadt@
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/aarch64/SYS.h10
-rw-r--r--libexec/ld.so/aarch64/rtld_machine.c4
2 files changed, 8 insertions, 6 deletions
diff --git a/libexec/ld.so/aarch64/SYS.h b/libexec/ld.so/aarch64/SYS.h
index 8131bd9b9fb..46ed6aca5c0 100644
--- a/libexec/ld.so/aarch64/SYS.h
+++ b/libexec/ld.so/aarch64/SYS.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: SYS.h,v 1.3 2018/10/01 22:53:48 mortimer Exp $ */
+/* $OpenBSD: SYS.h,v 1.4 2020/01/26 02:19:44 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn
@@ -29,9 +29,11 @@
#include <machine/asm.h>
#include <sys/syscall.h>
-#define SYSTRAP(x) \
- ldr x8, =SYS_ ## x; \
- svc 0
+#define SYSTRAP(x) \
+ ldr x8, =SYS_ ## x ;\
+ svc 0 ;\
+ nop ;\
+ nop
#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 5ac50d715cf..d466b5a1776 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.18 2019/12/07 22:57:47 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.19 2020/01/26 02:19:44 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" : "+r" (arg1), "+r" (arg2)
+ __asm volatile("svc 0; nop; nop" : "+r" (arg1), "+r" (arg2)
: "r" (syscall_num), "r" (arg3)
: "cc", "memory");
}