path: root/ldso/dynlink.c
diff options
authorRich Felker <>2020-09-29 19:16:19 -0400
committerRich Felker <>2020-10-14 20:27:12 -0400
commit50716702d41d5f6f31c1075a1734b9f759477f0d (patch)
tree8757c11f267a0ccd9633ccf5fd70fb8c6e36705d /ldso/dynlink.c
parent1efc8eb2c7eda7664232ef0292b7283adf0db114 (diff)
ldso: use pthread_t rather than kernel tid to track ctor visitor
commit 188759bbee057aa94db2bbb7cf7f5855f3b9ab53 documented the intent to allow recursive dlopen based on tracking ctor_visitor, but used a kernel tid rather than the pthread_t to identify the caller. as a result, it would not behave as intended under fork by a ctor, where the child tid would not match.
Diffstat (limited to 'ldso/dynlink.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 15e9e4f9..af983692 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -78,7 +78,7 @@ struct dso {
struct dso **deps, *needed_by;
size_t ndeps_direct;
size_t next_dep;
- int ctor_visitor;
+ pthread_t ctor_visitor;
char *rpath_orig, *rpath;
struct tls_module tls;
size_t tls_id;
@@ -1378,7 +1378,7 @@ void __libc_exit_fini()
struct dso *p;
size_t dyn[DYN_CNT];
- int self = __pthread_self()->tid;
+ pthread_t self = __pthread_self();
/* Take both locks before setting shutting_down, so that
* either lock is sufficient to read its value. The lock
@@ -1470,7 +1470,7 @@ static void do_init_fini(struct dso **queue)
struct dso *p;
size_t dyn[DYN_CNT], i;
- int self = __pthread_self()->tid;
+ pthread_t self = __pthread_self();
for (i=0; (p=queue[i]); i++) {