summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-14 03:54:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-14 03:54:52 +0000
commit83ed6b063588c235e6100ff1c9fad1fbe2a9fbcb (patch)
tree15efaf58fa61357182b1187ab4e16684f9fe3272
parent89ef96962f5e822c080a1c7b8b4bc51dea0916bc (diff)
Now that we have sendsyslog(2), we can directly use it in the
(previously completely retarded) stack_smash_handler of ld.so ok beck miod tedu
-rw-r--r--libexec/ld.so/alpha/ldasm.S3
-rw-r--r--libexec/ld.so/alpha/syscall.h5
-rw-r--r--libexec/ld.so/amd64/ldasm.S3
-rw-r--r--libexec/ld.so/amd64/syscall.h3
-rw-r--r--libexec/ld.so/arm/ldasm.S3
-rw-r--r--libexec/ld.so/arm/syscall.h3
-rw-r--r--libexec/ld.so/hppa/ldasm.S8
-rw-r--r--libexec/ld.so/hppa/syscall.h3
-rw-r--r--libexec/ld.so/i386/ldasm.S3
-rw-r--r--libexec/ld.so/i386/syscall.h3
-rw-r--r--libexec/ld.so/m88k/ldasm.S5
-rw-r--r--libexec/ld.so/m88k/syscall.h3
-rw-r--r--libexec/ld.so/mips64/ldasm.S3
-rw-r--r--libexec/ld.so/mips64/syscall.h5
-rw-r--r--libexec/ld.so/powerpc/ldasm.S3
-rw-r--r--libexec/ld.so/powerpc/syscall.h5
-rw-r--r--libexec/ld.so/sh/ldasm.S3
-rw-r--r--libexec/ld.so/sh/syscall.h3
-rw-r--r--libexec/ld.so/sparc/ldasm.S13
-rw-r--r--libexec/ld.so/sparc/syscall.h3
-rw-r--r--libexec/ld.so/sparc64/ldasm.S9
-rw-r--r--libexec/ld.so/sparc64/syscall.h3
-rw-r--r--libexec/ld.so/util.c12
23 files changed, 81 insertions, 26 deletions
diff --git a/libexec/ld.so/alpha/ldasm.S b/libexec/ld.so/alpha/ldasm.S
index b419066e60a..927b79a7b04 100644
--- a/libexec/ld.so/alpha/ldasm.S
+++ b/libexec/ld.so/alpha/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.26 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.27 2014/07/14 03:54:50 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -256,6 +256,7 @@ DL_SYSCALL(fstat)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL(gettimeofday)
DL_SYSCALL_NOERR(issetugid)
DL_SYSCALL(lstat)
diff --git a/libexec/ld.so/alpha/syscall.h b/libexec/ld.so/alpha/syscall.h
index 4edf378ffe6..b9c8927701e 100644
--- a/libexec/ld.so/alpha/syscall.h
+++ b/libexec/ld.so/alpha/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.26 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.27 2014/07/14 03:54:50 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -41,7 +41,6 @@
int _dl_close(int);
__dead
int _dl_exit(int);
-int _dl_getentropy(char *, size_t);
int _dl_issetugid(void);
void * _dl_mmap(void *, size_t, int, int, int, off_t);
int _dl_mprotect(const void *, size_t, int);
@@ -58,6 +57,8 @@ int _dl_readlink(const char *, char *, size_t);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
+int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/amd64/ldasm.S b/libexec/ld.so/amd64/ldasm.S
index f3bf5369d7e..969e1a094ac 100644
--- a/libexec/ld.so/amd64/ldasm.S
+++ b/libexec/ld.so/amd64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.17 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.18 2014/07/14 03:54:50 deraadt Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -96,6 +96,7 @@ DL_SYSCALL(readlink)
DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL2(set_tcb,__set_tcb)
DL_SYSCALL2(_syscall,__syscall)
diff --git a/libexec/ld.so/amd64/syscall.h b/libexec/ld.so/amd64/syscall.h
index 71967e1bea6..91aa7ce285b 100644
--- a/libexec/ld.so/amd64/syscall.h
+++ b/libexec/ld.so/amd64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.14 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.15 2014/07/14 03:54:50 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/arm/ldasm.S b/libexec/ld.so/arm/ldasm.S
index 6752646ce98..8ec28ce2a8d 100644
--- a/libexec/ld.so/arm/ldasm.S
+++ b/libexec/ld.so/arm/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.15 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.16 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -125,6 +125,7 @@ DL_SYSCALL(readlink)
DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL2(sysctl,__sysctl)
diff --git a/libexec/ld.so/arm/syscall.h b/libexec/ld.so/arm/syscall.h
index 0fe68d6de54..2b56307b61b 100644
--- a/libexec/ld.so/arm/syscall.h
+++ b/libexec/ld.so/arm/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.14 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.15 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/hppa/ldasm.S b/libexec/ld.so/hppa/ldasm.S
index 136b448e0f5..868ab87a1f0 100644
--- a/libexec/ld.so/hppa/ldasm.S
+++ b/libexec/ld.so/hppa/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.14 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.15 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -272,6 +272,12 @@ ENTRY(_dl_getentropy,0)
nop
EXIT(_dl_getentropy)
+ENTRY(_dl_sendsyslog,0)
+ SYSCALL(sendsyslog)
+ bv r0(rp)
+ nop
+EXIT(_dl_sendsyslog)
+
ENTRY(_dl_sigprocmask,0)
stw arg2, HPPA_FRAME_ARG(2)(sp)
diff --git a/libexec/ld.so/hppa/syscall.h b/libexec/ld.so/hppa/syscall.h
index 71967e1bea6..da985444cac 100644
--- a/libexec/ld.so/hppa/syscall.h
+++ b/libexec/ld.so/hppa/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.14 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.15 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/i386/ldasm.S b/libexec/ld.so/i386/ldasm.S
index bbcef533d09..7750a8f0dd5 100644
--- a/libexec/ld.so/i386/ldasm.S
+++ b/libexec/ld.so/i386/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.18 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.19 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -121,6 +121,7 @@ DL_SYSCALL(readlink)
DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL2(sysctl,__sysctl)
DL_SYSCALL(getdents)
diff --git a/libexec/ld.so/i386/syscall.h b/libexec/ld.so/i386/syscall.h
index 40b71511d28..4653e472b27 100644
--- a/libexec/ld.so/i386/syscall.h
+++ b/libexec/ld.so/i386/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.18 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.19 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/m88k/ldasm.S b/libexec/ld.so/m88k/ldasm.S
index 2d6c509dbaa..e392d40882f 100644
--- a/libexec/ld.so/m88k/ldasm.S
+++ b/libexec/ld.so/m88k/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.12 2014/07/10 07:41:26 miod Exp $ */
+/* $OpenBSD: ldasm.S,v 1.13 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -209,6 +209,9 @@ DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
jmp %r1
+DL_SYSCALL(sendsyslog)
+ jmp %r1
+
DL_SYSCALL2(getcwd,__getcwd)
jmp %r1
diff --git a/libexec/ld.so/m88k/syscall.h b/libexec/ld.so/m88k/syscall.h
index 9d60ba31fd6..08263dab696 100644
--- a/libexec/ld.so/m88k/syscall.h
+++ b/libexec/ld.so/m88k/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.10 2014/07/09 12:51:20 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.11 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/mips64/ldasm.S b/libexec/ld.so/mips64/ldasm.S
index b9e79b986e2..5b5bb8fa52a 100644
--- a/libexec/ld.so/mips64/ldasm.S
+++ b/libexec/ld.so/mips64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.12 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.13 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -170,6 +170,7 @@ DL_SYSCALL(fstat)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL(gettimeofday)
DL_SYSCALL_NOERR(issetugid)
DL_SYSCALL(lstat)
diff --git a/libexec/ld.so/mips64/syscall.h b/libexec/ld.so/mips64/syscall.h
index 1e81704c103..ed866886b26 100644
--- a/libexec/ld.so/mips64/syscall.h
+++ b/libexec/ld.so/mips64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.16 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.17 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -44,7 +44,6 @@ int _dl_exit(int);
int _dl_fstat(int, struct stat *);
int _dl_getcwd(char *, size_t);
ssize_t _dl_getdents(int, char *, size_t);
-int _dl_getentropy(char *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
int _dl_issetugid(void);
int _dl_lstat(const char *, struct stat *);
@@ -57,6 +56,8 @@ int _dl_sigprocmask(int, const sigset_t *, sigset_t *);
long _dl__syscall(quad_t, ...);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_utrace(const char *, const void *, size_t);
+int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fd, off_t offset, int whence)
diff --git a/libexec/ld.so/powerpc/ldasm.S b/libexec/ld.so/powerpc/ldasm.S
index e61840f863e..478c1d92908 100644
--- a/libexec/ld.so/powerpc/ldasm.S
+++ b/libexec/ld.so/powerpc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.20 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.21 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -209,6 +209,7 @@ DL_SYSCALL(fstat)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL(gettimeofday)
DL_SYSCALL_NOERR(issetugid)
DL_SYSCALL(lstat)
diff --git a/libexec/ld.so/powerpc/syscall.h b/libexec/ld.so/powerpc/syscall.h
index bb3db95a741..15c4239b0c1 100644
--- a/libexec/ld.so/powerpc/syscall.h
+++ b/libexec/ld.so/powerpc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.34 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.35 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -46,7 +46,6 @@ void _dl_exit(int);
int _dl_fstat(int, struct stat *);
int _dl_getcwd(char *, size_t);
ssize_t _dl_getdents(int, char *, size_t);
-int _dl_getentropy(char *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
int _dl_issetugid(void);
int _dl_lstat(const char *, struct stat *);
@@ -61,6 +60,8 @@ long _dl__syscall(quad_t, ...);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_utrace(const char *, const void *, size_t);
ssize_t _dl_write(int, const char *, size_t);
+int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/sh/ldasm.S b/libexec/ld.so/sh/ldasm.S
index 37e4225c202..fed5cabae0e 100644
--- a/libexec/ld.so/sh/ldasm.S
+++ b/libexec/ld.so/sh/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.16 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.17 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2006 Dale Rahn
@@ -208,6 +208,7 @@ DL_SYSCALL(readlink)
DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
+DL_SYSCALL(sendsyslog)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL2(sysctl,__sysctl)
diff --git a/libexec/ld.so/sh/syscall.h b/libexec/ld.so/sh/syscall.h
index 27c3fa2e259..2cc9fa1028b 100644
--- a/libexec/ld.so/sh/syscall.h
+++ b/libexec/ld.so/sh/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.12 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.13 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/sparc/ldasm.S b/libexec/ld.so/sparc/ldasm.S
index 291fd3cf9bb..c989d078aa2 100644
--- a/libexec/ld.so/sparc/ldasm.S
+++ b/libexec/ld.so/sparc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.24 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.25 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -371,6 +371,17 @@ _dl_getentropy:
retl
sub %g0, %o0, %o0 ! error: result = -errno
+ .section ".text"
+ .align 4
+ .global _dl_sendsyslog
+ .type _dl_sendsyslog,@function
+_dl_sendsyslog:
+ mov SYS_sendsyslog | SYSCALL_G2RFLAG, %g1 ! calling sys_sendsyslog
+ 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 a07aa2b9520..fefe02114a7 100644
--- a/libexec/ld.so/sparc/syscall.h
+++ b/libexec/ld.so/sparc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.19 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.20 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index 3ade982da74..a49bd755a54 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.36 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.37 2014/07/14 03:54:51 deraadt Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -347,3 +347,10 @@ _ENTRY(_dl_getentropy)
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
+
+_ENTRY(_dl_sendsyslog)
+ mov SYS_sendsyslog | SYSCALL_G2RFLAG, %g1 ! calling sys_sendsyslog
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
diff --git a/libexec/ld.so/sparc64/syscall.h b/libexec/ld.so/sparc64/syscall.h
index 8652252e597..d13d4bbf88c 100644
--- a/libexec/ld.so/sparc64/syscall.h
+++ b/libexec/ld.so/sparc64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.26 2014/07/09 12:51:21 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.27 2014/07/14 03:54:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,7 @@ int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
+int _dl_sendsyslog(const char *, size_t);
static inline off_t
_dl_lseek(int fildes, off_t offset, int whence)
diff --git a/libexec/ld.so/util.c b/libexec/ld.so/util.c
index 626609552de..ef86abb9ef8 100644
--- a/libexec/ld.so/util.c
+++ b/libexec/ld.so/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.34 2014/07/06 07:39:07 otto Exp $ */
+/* $OpenBSD: util.c,v 1.35 2014/07/14 03:54:50 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -42,6 +42,16 @@ void __stack_smash_handler(char [], int);
void
__stack_smash_handler(char func[], int damaged)
{
+ extern const char *_dl_progname;
+ char message[100];
+
+ /* <10> indicates LOG_CRIT */
+ _dl_strlcpy(message, "<10>ld.so:", sizeof message);
+ _dl_strlcat(message, _dl_progname, sizeof message);
+ _dl_strlcat(message, "stack overflow in function ", sizeof message);
+ _dl_strlcat(message, func, sizeof message);
+
+ _dl_sendsyslog(message, _dl_strlen(message));
_dl_exit(127);
}