summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-15 03:41:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-15 03:41:25 +0000
commite708d2b2be40c441b8dd28c6ee1bdbe001ef6034 (patch)
tree5feeb7f7fe8d343ef9a10c65d26b8e43b480c0e7 /libexec
parentd80676da5e414fe62f5c9c19ba0b1430b2b33334 (diff)
ldd(1) sets environment variable LD_TRACE_LOADED_OBJECTS to tell ld.so
that it should show information about the program it loads, rather than run it. In that specific case, ld.so can pledge to "stdio rpath" to ensure that code path in ld.so has no bugs. Yes, a pledge in ld.so.... who'd have thought! ok guenther
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.so/alpha/ldasm.S3
-rw-r--r--libexec/ld.so/alpha/syscall.h3
-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/loader.c7
-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.h3
-rw-r--r--libexec/ld.so/powerpc/ldasm.S3
-rw-r--r--libexec/ld.so/powerpc/syscall.h3
-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
23 files changed, 72 insertions, 24 deletions
diff --git a/libexec/ld.so/alpha/ldasm.S b/libexec/ld.so/alpha/ldasm.S
index 4f81a2e5b84..15050821587 100644
--- a/libexec/ld.so/alpha/ldasm.S
+++ b/libexec/ld.so/alpha/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.31 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.32 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -314,6 +314,7 @@ DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
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 67b9314d0d5..70697b1e95c 100644
--- a/libexec/ld.so/alpha/syscall.h
+++ b/libexec/ld.so/alpha/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.29 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.30 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ long _dl__syscall(quad_t, ...);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/amd64/ldasm.S b/libexec/ld.so/amd64/ldasm.S
index f67988c4cb0..f50c07cc49b 100644
--- a/libexec/ld.so/amd64/ldasm.S
+++ b/libexec/ld.so/amd64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.20 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.21 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -97,6 +97,7 @@ DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
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 cb3a657d4ff..e7bcca1b427 100644
--- a/libexec/ld.so/amd64/syscall.h
+++ b/libexec/ld.so/amd64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.17 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.18 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/arm/ldasm.S b/libexec/ld.so/arm/ldasm.S
index 6d6847e37de..b505b95b245 100644
--- a/libexec/ld.so/arm/ldasm.S
+++ b/libexec/ld.so/arm/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.18 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.19 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -126,6 +126,7 @@ DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(sysctl)
diff --git a/libexec/ld.so/arm/syscall.h b/libexec/ld.so/arm/syscall.h
index d3d83a5502d..8a1aeafdd8d 100644
--- a/libexec/ld.so/arm/syscall.h
+++ b/libexec/ld.so/arm/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.17 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.18 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/hppa/ldasm.S b/libexec/ld.so/hppa/ldasm.S
index f1d9bf2a453..a53f810c27d 100644
--- a/libexec/ld.so/hppa/ldasm.S
+++ b/libexec/ld.so/hppa/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.17 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.18 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -278,4 +278,10 @@ ENTRY(_dl_sendsyslog,0)
nop
EXIT(_dl_sendsyslog)
+ENTRY(_dl_pledge,0)
+ SYSCALL(pledge)
+ bv r0(rp)
+ nop
+EXIT(_dl_pledge)
+
.end
diff --git a/libexec/ld.so/hppa/syscall.h b/libexec/ld.so/hppa/syscall.h
index cb3a657d4ff..e7bcca1b427 100644
--- a/libexec/ld.so/hppa/syscall.h
+++ b/libexec/ld.so/hppa/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.17 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.18 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/i386/ldasm.S b/libexec/ld.so/i386/ldasm.S
index 411ed0b0d6a..695c7bb4857 100644
--- a/libexec/ld.so/i386/ldasm.S
+++ b/libexec/ld.so/i386/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.22 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.23 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -122,6 +122,7 @@ DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(sysctl)
DL_SYSCALL(getdents)
diff --git a/libexec/ld.so/i386/syscall.h b/libexec/ld.so/i386/syscall.h
index 47c83d480e2..ccf1f886c25 100644
--- a/libexec/ld.so/i386/syscall.h
+++ b/libexec/ld.so/i386/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.21 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.22 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 3542b163170..d30eeb7a3f6 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.155 2015/08/18 17:34:44 deraadt Exp $ */
+/* $OpenBSD: loader.c,v 1.156 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -521,8 +521,11 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data)
_dl_prebind_post_resolve();
- if (_dl_debug || _dl_traceld)
+ if (_dl_debug || _dl_traceld) {
+ if (_dl_traceld)
+ _dl_pledge("stdio rpath", NULL);
_dl_show_objects();
+ }
DL_DEB(("dynamic loading done, %s.\n",
(failed == 0) ? "success":"failed"));
diff --git a/libexec/ld.so/m88k/ldasm.S b/libexec/ld.so/m88k/ldasm.S
index 3aa0f2a21f9..d5adc28a130 100644
--- a/libexec/ld.so/m88k/ldasm.S
+++ b/libexec/ld.so/m88k/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.15 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.16 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -212,6 +212,9 @@ DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
jmp %r1
+DL_SYSCALL(pledge)
+ 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 f9db51602f1..1aea1d863f0 100644
--- a/libexec/ld.so/m88k/syscall.h
+++ b/libexec/ld.so/m88k/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.13 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.14 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/mips64/ldasm.S b/libexec/ld.so/mips64/ldasm.S
index 5c8438e4848..a3ad5a36ed3 100644
--- a/libexec/ld.so/mips64/ldasm.S
+++ b/libexec/ld.so/mips64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.15 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.16 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -152,6 +152,7 @@ DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
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 873018586d8..d3186e71b1f 100644
--- a/libexec/ld.so/mips64/syscall.h
+++ b/libexec/ld.so/mips64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.19 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.20 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 1998-2002 Opsycon AB, Sweden.
@@ -51,6 +51,7 @@ int _dl_munmap(const void *, size_t);
int _dl_open(const char *, int);
ssize_t _dl_read(int, const char *, size_t);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
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);
diff --git a/libexec/ld.so/powerpc/ldasm.S b/libexec/ld.so/powerpc/ldasm.S
index ee9ff234946..0919219d2bf 100644
--- a/libexec/ld.so/powerpc/ldasm.S
+++ b/libexec/ld.so/powerpc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.25 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.26 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -148,6 +148,7 @@ DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(getdents)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
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 6c7f5adce6f..52a09661e0e 100644
--- a/libexec/ld.so/powerpc/syscall.h
+++ b/libexec/ld.so/powerpc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.37 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.38 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -52,6 +52,7 @@ int _dl_munmap(const void *, size_t);
int _dl_open(const char *, int);
ssize_t _dl_read(int, const char *, size_t);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
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);
diff --git a/libexec/ld.so/sh/ldasm.S b/libexec/ld.so/sh/ldasm.S
index 9fb9cc11a66..a8ba04e8fc3 100644
--- a/libexec/ld.so/sh/ldasm.S
+++ b/libexec/ld.so/sh/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.20 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.21 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2006 Dale Rahn
@@ -191,6 +191,7 @@ DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
DL_SYSCALL(sendsyslog)
+DL_SYSCALL(pledge)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(sysctl)
diff --git a/libexec/ld.so/sh/syscall.h b/libexec/ld.so/sh/syscall.h
index b94ae84dce0..3054adddd7e 100644
--- a/libexec/ld.so/sh/syscall.h
+++ b/libexec/ld.so/sh/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.15 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.16 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/sparc/ldasm.S b/libexec/ld.so/sparc/ldasm.S
index e2e6a1d65fe..e21860bf647 100644
--- a/libexec/ld.so/sparc/ldasm.S
+++ b/libexec/ld.so/sparc/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.27 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.28 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -364,6 +364,17 @@ _dl_sendsyslog:
retl
sub %g0, %o0, %o0 ! error: result = -errno
+ .section ".text"
+ .align 4
+ .global _dl_pledge
+ .type _dl_pledge,@function
+_dl_pledge:
+ mov SYS_pledge | SYSCALL_G2RFLAG, %g1 ! calling sys_pledge
+ 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 8bfff483670..498cc6fe718 100644
--- a/libexec/ld.so/sparc/syscall.h
+++ b/libexec/ld.so/sparc/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.22 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.23 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index b5a90f7d202..61908f6d3fb 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.39 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.40 2015/11/15 03:41:24 deraadt Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -341,3 +341,10 @@ _ENTRY(_dl_sendsyslog)
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
+
+_ENTRY(_dl_pledge)
+ mov SYS_pledge | SYSCALL_G2RFLAG, %g1 ! calling sys_pledge
+ 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 e81ffe4b613..caf41776c7f 100644
--- a/libexec/ld.so/sparc64/syscall.h
+++ b/libexec/ld.so/sparc64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.29 2015/09/19 20:56:47 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.30 2015/11/15 03:41:24 deraadt Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -52,6 +52,7 @@ ssize_t _dl_getdents(int, char *, size_t);
int _dl_sysctl(const int *, u_int, void *, size_t *, void *, size_t);
int _dl_gettimeofday(struct timeval *, struct timezone *);
ssize_t _dl_readlink(const char *, char *, size_t);
+int _dl_pledge(const char *, const char **);
int _dl_lstat(const char *, struct stat *);
int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);