summaryrefslogtreecommitdiff
path: root/lib/csu/i386
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/i386
parent49917aa9a3d7bc9525154ccaed369d2ce4311649 (diff)
In static binaries, invoke kbind() once to disable it.
With much assistance from miod@ ok deraadt@@
Diffstat (limited to 'lib/csu/i386')
-rw-r--r--lib/csu/i386/md_init.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/csu/i386/md_init.h b/lib/csu/i386/md_init.h
index 11a84c367f1..9e1606fa5f1 100644
--- a/lib/csu/i386/md_init.h
+++ b/lib/csu/i386/md_init.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.5 2014/12/22 21:58:25 kurt Exp $ */
+/* $OpenBSD: md_init.h,v 1.6 2015/09/01 05:40:06 guenther Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -133,3 +133,12 @@
" int $0x80 \n" \
" ret \n" \
" .previous")
+
+#include <sys/syscall.h>
+#define MD_DISABLE_KBIND \
+ do { \
+ register long syscall_num __asm("eax") = SYS_kbind; \
+ __asm volatile("pushl $0; push %%eax; int $0x80;" \
+ " addl $8, %%esp" : "+a" (syscall_num) : \
+ : "edx", "cc"); \
+ } while (0)