summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2019-05-10 01:31:30 +0000
committerguenther <guenther@openbsd.org>2019-05-10 01:31:30 +0000
commit50634ea57793533fe6ade2a7be1ea9f1ad0e928b (patch)
treece645d681cc3206965f4db724779549e1a73f78b /lib/libc
parentDelete superfluous #includes of <ifaddrs.h>, <net/if_dl.h>, and <net/if_enc.h> (diff)
downloadwireguard-openbsd-50634ea57793533fe6ade2a7be1ea9f1ad0e928b.tar.xz
wireguard-openbsd-50634ea57793533fe6ade2a7be1ea9f1ad0e928b.zip
Apply retpoline protection to the indirect call to the thread startfunc
ok mortimer@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/amd64/sys/tfork_thread.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/arch/amd64/sys/tfork_thread.S b/lib/libc/arch/amd64/sys/tfork_thread.S
index 84cf0ca790d..f0d9c494aef 100644
--- a/lib/libc/arch/amd64/sys/tfork_thread.S
+++ b/lib/libc/arch/amd64/sys/tfork_thread.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: tfork_thread.S,v 1.7 2019/03/15 05:42:38 kevlo Exp $ */
+/* $OpenBSD: tfork_thread.S,v 1.8 2019/05/10 01:31:30 guenther Exp $ */
/*-
* Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
* Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
@@ -62,14 +62,19 @@ ENTRY(__tfork_thread)
jz 1f
ret
+ /* the retpoline we'll use to call the child's main */
+ _ALIGN_TRAPS
+0: JMP_RETPOLINE(r8)
+
/*
* If we are in the child (new thread), then
* set-up the call to the internal subroutine. If it
* returns, then call __threxit.
*/
+ _ALIGN_TRAPS
1:
movq %r9, %rdi
- call *%r8
+ call 0b
/*
* Thread exit system call