summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-05-15 11:58:01 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-05-15 11:58:01 +0000
commit1659238a0ca2744d18f4b9a3c77ed1e224510e11 (patch)
tree1556ea81535141af9c65634e9a1b4fa2b251f050 /libexec
parent8ffb1c8ce15ca01ad17ee0a88bc03cc5ccdba162 (diff)
downloadsrc-test2-1659238a0ca2744d18f4b9a3c77ed1e224510e11.tar.gz
src-test2-1659238a0ca2744d18f4b9a3c77ed1e224510e11.zip
Implement RTLD_DEEPBIND.
PR: 246462 Tested by: Martin Birgmeier <d8zNeCFG@aon.at> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D24841
Notes
Notes: svn path=/head/; revision=361073
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c4
-rw-r--r--libexec/rtld-elf/rtld.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 4b26aefb5240..c4c17c2d3a8a 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -3366,6 +3366,8 @@ rtld_dlopen(const char *name, int fd, int mode)
lo_flags |= RTLD_LO_NODELETE;
if (mode & RTLD_NOLOAD)
lo_flags |= RTLD_LO_NOLOAD;
+ if (mode & RTLD_DEEPBIND)
+ lo_flags |= RTLD_LO_DEEPBIND;
if (ld_tracing != NULL)
lo_flags |= RTLD_LO_TRACE | RTLD_LO_IGNSTLS;
@@ -3417,6 +3419,8 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags,
if (globallist_next(old_obj_tail) != NULL) {
/* We loaded something new. */
assert(globallist_next(old_obj_tail) == obj);
+ if ((lo_flags & RTLD_LO_DEEPBIND) != 0)
+ obj->symbolic = true;
result = 0;
if ((lo_flags & (RTLD_LO_EARLY | RTLD_LO_IGNSTLS)) == 0 &&
obj->static_tls && !allocate_tls_offset(obj)) {
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 7812ebb15390..c7bbc4e46e51 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -309,6 +309,7 @@ TAILQ_HEAD(obj_entry_q, Struct_Obj_Entry);
#define RTLD_LO_EARLY 0x20 /* Do not call ctors, postpone it to the
initialization during the image start. */
#define RTLD_LO_IGNSTLS 0x40 /* Do not allocate static TLS */
+#define RTLD_LO_DEEPBIND 0x80 /* Force symbolic for this object */
/*
* Symbol cache entry used during relocation to avoid multiple lookups