projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix regression in dlsym: rejection of special RTLD_* handles as invalid
[musl]
/
src
/
ldso
/
dynlink.c
diff --git
a/src/ldso/dynlink.c
b/src/ldso/dynlink.c
index
782e979
..
e73806c
100644
(file)
--- a/
src/ldso/dynlink.c
+++ b/
src/ldso/dynlink.c
@@
-1091,7
+1091,7
@@
end:
return p;
}
return p;
}
-static int invalid_dso_handle(
struct dso
*h)
+static int invalid_dso_handle(
void
*h)
{
struct dso *p;
for (p=head; p; p=p->next) if (h==p) return 0;
{
struct dso *p;
for (p=head; p; p=p->next) if (h==p) return 0;
@@
-1119,7
+1119,8
@@
static void *do_dlsym(struct dso *p, const char *s, void *ra)
return __tls_get_addr((size_t []){def.dso->tls_id, def.sym->st_value});
return def.dso->base + def.sym->st_value;
}
return __tls_get_addr((size_t []){def.dso->tls_id, def.sym->st_value});
return def.dso->base + def.sym->st_value;
}
- if (invalid_dso_handle(p)) return 0;
+ if (p != RTLD_DEFAULT && p != RTLD_NEXT && invalid_dso_handle(p))
+ return 0;
if (p->ghashtab) {
gh = gnu_hash(s);
sym = gnu_lookup(s, gh, p);
if (p->ghashtab) {
gh = gnu_hash(s);
sym = gnu_lookup(s, gh, p);
@@
-1188,7
+1189,7
@@
int __dladdr(void *addr, Dl_info *info)
}
for (; nsym; nsym--, sym++) {
}
for (; nsym; nsym--, sym++) {
- if (sym->st_
shndx && sym->st_
value
+ if (sym->st_value
&& (1<<(sym->st_info&0xf) & OK_TYPES)
&& (1<<(sym->st_info>>4) & OK_BINDS)) {
void *symaddr = p->base + sym->st_value;
&& (1<<(sym->st_info&0xf) & OK_TYPES)
&& (1<<(sym->st_info>>4) & OK_BINDS)) {
void *symaddr = p->base + sym->st_value;
@@
-1246,7
+1247,7
@@
int dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size_t size, void
return ret;
}
#else
return ret;
}
#else
-static int invalid_dso_handle(
struct dso
*h)
+static int invalid_dso_handle(
void
*h)
{
snprintf(errbuf, sizeof errbuf, "Invalid library handle %p", (void *)h);
errflag = 1;
{
snprintf(errbuf, sizeof errbuf, "Invalid library handle %p", (void *)h);
errflag = 1;