aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-04-10 12:32:24 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-04-10 14:33:33 +0000
commit08bfbd43594b7642de0d2487550f36b0ee1eceba (patch)
tree2eeb3c8acec61c3de5be467469c8fdea07f3780d /libexec
parent4d7f08c84bcfcd75ba23b06e07a8e5dba1d4a44f (diff)
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld_lock.c17
-rw-r--r--libexec/rtld-elf/rtld_lock.h4
2 files changed, 19 insertions, 2 deletions
diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c
index d94bd1a283e9..4d54c687ee6f 100644
--- a/libexec/rtld-elf/rtld_lock.c
+++ b/libexec/rtld-elf/rtld_lock.c
@@ -344,8 +344,23 @@ lockdflt_init(void)
void
_rtld_thread_init(struct RtldLockInfo *pli)
{
- int flags, i;
+ const Obj_Entry *obj;
+ SymLook req;
void *locks[RTLD_LOCK_CNT];
+ int flags, i, res;
+
+ if (pli == NULL) {
+ lockinfo.rtli_version = RTLI_VERSION;
+ } else {
+ lockinfo.rtli_version = RTLI_VERSION_ONE;
+ obj = obj_from_addr(pli->lock_create);
+ if (obj != NULL) {
+ symlook_init(&req, "_pli_rtli_version");
+ res = symlook_obj(&req, obj);
+ if (res == 0)
+ lockinfo.rtli_version = pli->rtli_version;
+ }
+ }
/* disable all locking while this function is running */
flags = thread_mask_set(~0);
diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h
index ecc733a06e44..7a61a1a525e2 100644
--- a/libexec/rtld-elf/rtld_lock.h
+++ b/libexec/rtld-elf/rtld_lock.h
@@ -30,7 +30,9 @@
#ifndef _RTLD_LOCK_H_
#define _RTLD_LOCK_H_
-#define RTLI_VERSION 0x01
+#define RTLI_VERSION_ONE 0x01
+#define RTLI_VERSION 0x01
+
#define MAX_RTLD_LOCKS 8
struct RtldLockInfo