summaryrefslogtreecommitdiff
path: root/lib/csu/sh
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-09-01 05:40:07 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-09-01 05:40:07 +0000
commit6552896c83d8e0c94ad668c1e07eec78a5035820 (patch)
treed856dc9a981eb7f505c48e9852ed0636e4fb6f76 /lib/csu/sh
parent49917aa9a3d7bc9525154ccaed369d2ce4311649 (diff)
In static binaries, invoke kbind() once to disable it.
With much assistance from miod@ ok deraadt@@
Diffstat (limited to 'lib/csu/sh')
-rw-r--r--lib/csu/sh/md_init.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/csu/sh/md_init.h b/lib/csu/sh/md_init.h
index 7a1b5d971b2..359b5ac7347 100644
--- a/lib/csu/sh/md_init.h
+++ b/lib/csu/sh/md_init.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.4 2014/12/30 19:26:38 miod Exp $ */
+/* $OpenBSD: md_init.h,v 1.5 2015/09/01 05:40:06 guenther Exp $ */
/* $NetBSD: dot_init.h,v 1.3 2005/12/24 22:02:10 perry Exp $ */
/*-
@@ -147,3 +147,12 @@ __asm(".section " #section "\n" \
/* no ASM stub for __start; the C routine can be called directly */
#define MD_START ___start
+
+#include <sys/syscall.h>
+#define MD_DISABLE_KBIND \
+ do { \
+ register long syscall_num __asm("r0") = SYS_kbind; \
+ register void *arg1 __asm("r4") = NULL; \
+ __asm volatile("trapa #0x80" : "+r" (syscall_num) \
+ : "r" (arg1) : "r1", "cc"); \
+ } while (0)