projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix missing synchronization in calls from dynamic linker to global ctors
[musl]
/
src
/
ldso
/
dynlink.c
diff --git
a/src/ldso/dynlink.c
b/src/ldso/dynlink.c
index
eac07d9
..
ac4b669
100644
(file)
--- a/
src/ldso/dynlink.c
+++ b/
src/ldso/dynlink.c
@@
-479,7
+479,7
@@
static struct dso *load_library(const char *name)
FILE *f = fopen(ETC_LDSO_PATH, "rbe");
if (f) {
if (getdelim(&sys_path, (size_t[1]){0}, 0, f) <= 0) {
FILE *f = fopen(ETC_LDSO_PATH, "rbe");
if (f) {
if (getdelim(&sys_path, (size_t[1]){0}, 0, f) <= 0) {
-
if (sys_path)
free(sys_path);
+ free(sys_path);
sys_path = "";
}
fclose(f);
sys_path = "";
}
fclose(f);
@@
-692,6
+692,10
@@
static void do_init_fini(struct dso *p)
}
if (dyn[0] & (1<<DT_INIT))
((void (*)(void))(p->base + dyn[DT_INIT]))();
}
if (dyn[0] & (1<<DT_INIT))
((void (*)(void))(p->base + dyn[DT_INIT]))();
+ if (!need_locking && libc.threads_minus_1) {
+ need_locking = 1;
+ pthread_mutex_lock(&init_fini_lock);
+ }
}
if (need_locking) pthread_mutex_unlock(&init_fini_lock);
}
}
if (need_locking) pthread_mutex_unlock(&init_fini_lock);
}