summaryrefslogtreecommitdiff
path: root/libexec/ld.so/sparc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-05-03 16:10:53 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-05-03 16:10:53 +0000
commitec4b8bbf8212a67706e8bf0d84a933147a5bf89c (patch)
treef06a750d1a5fbec05783cff2a3ba488c9e288a69 /libexec/ld.so/sparc
parentb1f9a206d3729c6275222429f2ec0529817fc0b3 (diff)
prebind - how to prelink a binary without throwing security out the window
Prelink fixes the address of libraries making 'return to libc' attacks trival, prebind uses a different method to achieve most of the same gains, however without adding any security conerns. Still under development, now in-tree.
Diffstat (limited to 'libexec/ld.so/sparc')
-rw-r--r--libexec/ld.so/sparc/ldasm.S14
-rw-r--r--libexec/ld.so/sparc/syscall.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/libexec/ld.so/sparc/ldasm.S b/libexec/ld.so/sparc/ldasm.S
index 41304417ab3..1b210378132 100644
--- a/libexec/ld.so/sparc/ldasm.S
+++ b/libexec/ld.so/sparc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.14 2004/05/25 15:56:18 deraadt Exp $ */
+/* $OpenBSD: ldasm.S,v 1.15 2006/05/03 16:10:52 drahn Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -319,6 +319,18 @@ _dl_sigprocmask:
retl
clr %o0
+
+ .section ".text"
+ .align 4
+ .global _dl_gettimeofday
+ .type _dl_gettimeofday,@function
+_dl_gettimeofday:
+ mov SYS_gettimeofday | SYSCALL_G2RFLAG, %g1 ! calling sys_gettimeofday
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
+
/*
* V8 sparc .{,u}{mul,div,rem} replacements.
* We try to mimic them 100%. Full 64 bit sources or outputs, and
diff --git a/libexec/ld.so/sparc/syscall.h b/libexec/ld.so/sparc/syscall.h
index 92ebc12d3d3..bb07f56cab0 100644
--- a/libexec/ld.so/sparc/syscall.h
+++ b/libexec/ld.so/sparc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.7 2004/05/25 15:56:18 deraadt Exp $ */
+/* $OpenBSD: syscall.h,v 1.8 2006/05/03 16:10:52 drahn Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -53,6 +53,7 @@ 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);
+int _dl_gettimeofday(struct timeval *tp, struct timezone *tzp);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)