summaryrefslogtreecommitdiff
path: root/libexec/ld.so/i386
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-05-30 01:13:54 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-05-30 01:13:54 +0000
commite0412874e2e423e326125c2e936d4d27d7f2e87b (patch)
treea812a7dd7f9a4d94243a97d3947e66fe9d372314 /libexec/ld.so/i386
parent441e1efd56d21b17558bc2e2803d3409279c359b (diff)
When loading a shared object or libraries dependant object, load them
in random order. This will reduce the possiblity of a buffer overflow being able to predict the addresss of useful code. Can be disabled with the LD_NORANDOM environment variable for debugging purposes. ok deraadt.
Diffstat (limited to 'libexec/ld.so/i386')
-rw-r--r--libexec/ld.so/i386/ldasm.S12
-rw-r--r--libexec/ld.so/i386/syscall.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/libexec/ld.so/i386/ldasm.S b/libexec/ld.so/i386/ldasm.S
index cf20d25310d..230deaa30a2 100644
--- a/libexec/ld.so/i386/ldasm.S
+++ b/libexec/ld.so/i386/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.4 2003/02/02 16:57:58 deraadt Exp $ */
+/* $OpenBSD: ldasm.S,v 1.5 2003/05/30 01:13:53 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -210,6 +210,16 @@ _dl_fcntl:
jb 1f /* error: result = -errno */
ret
+ .section ".text"
+ .align 4
+ .global _dl_sysctl
+ .type _dl_sysctl,@function
+_dl_sysctl:
+ mov $SYS___sysctl, %eax
+ int $0x80
+ jb 1f /* error: result = -errno */
+ ret
+
.section ".text"
.align 4
diff --git a/libexec/ld.so/i386/syscall.h b/libexec/ld.so/i386/syscall.h
index f853ad4cb6c..4a7e23c0c6f 100644
--- a/libexec/ld.so/i386/syscall.h
+++ b/libexec/ld.so/i386/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.2 2002/12/18 19:20:02 drahn Exp $ */
+/* $OpenBSD: syscall.h,v 1.3 2003/05/30 01:13:53 drahn Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -59,6 +59,7 @@ int _dl_fstat(int, struct stat *);
int _dl_fcntl(int, int, ...);
int _dl_getdirentries(int, char*, int, long *);
int _dl_sigprocmask(int, const sigset_t *, sigset_t *);
+int _dl_sysctl(int *, u_int, void *, size_t *, void *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)