summaryrefslogtreecommitdiffstats
path: root/lib/csu/sparc/md_init.h
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-09-01 05:40:06 +0000
committerguenther <guenther@openbsd.org>2015-09-01 05:40:06 +0000
commit0a8a9c346022d9ea9d2d120f75edf8549c4915cf (patch)
treee3c4076db1bbfd4052130f4025582261466c9f4c /lib/csu/sparc/md_init.h
parentinitialise the width var in db_struct_offset_cmd() (diff)
downloadwireguard-openbsd-0a8a9c346022d9ea9d2d120f75edf8549c4915cf.tar.xz
wireguard-openbsd-0a8a9c346022d9ea9d2d120f75edf8549c4915cf.zip
In static binaries, invoke kbind() once to disable it.
With much assistance from miod@ ok deraadt@@
Diffstat (limited to 'lib/csu/sparc/md_init.h')
-rw-r--r--lib/csu/sparc/md_init.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/csu/sparc/md_init.h b/lib/csu/sparc/md_init.h
index 4eda521741e..23fdfc7b0cc 100644
--- a/lib/csu/sparc/md_init.h
+++ b/lib/csu/sparc/md_init.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.3 2015/07/03 11:17:25 miod Exp $ */
+/* $OpenBSD: md_init.h,v 1.4 2015/09/01 05:40:06 guenther Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -136,3 +136,12 @@
" neg %o0 \n" \
\
" .previous")
+
+#include <sys/syscall.h>
+#define MD_DISABLE_KBIND \
+ do { \
+ register long syscall_num __asm("g1") = SYS_kbind; \
+ register void *arg1 __asm("o0") = NULL; \
+ __asm volatile("t 0" : "+r" (arg1) : "r" (syscall_num) \
+ : "o1", "cc"); \
+ } while (0)