discard dso descriptors after performing relocations
eventually (once dlopen exists) this behavior will be conditional on dlopen/dlsym not being reachable.
This commit is contained in:
parent
368ba4a0a9
commit
e8dbf00a78
1 changed files with 12 additions and 0 deletions
|
|
@ -322,6 +322,16 @@ static void reloc_all(struct dso *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_all(struct dso *p)
|
||||||
|
{
|
||||||
|
struct dso *n;
|
||||||
|
while (p) {
|
||||||
|
n = p->next;
|
||||||
|
if (p->map) free(p);
|
||||||
|
p = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void *__dynlink(int argc, char **argv, size_t *got)
|
void *__dynlink(int argc, char **argv, size_t *got)
|
||||||
{
|
{
|
||||||
size_t *auxv, aux[AUX_CNT] = {0};
|
size_t *auxv, aux[AUX_CNT] = {0};
|
||||||
|
|
@ -387,6 +397,8 @@ void *__dynlink(int argc, char **argv, size_t *got)
|
||||||
|
|
||||||
reloc_all(head);
|
reloc_all(head);
|
||||||
|
|
||||||
|
free_all(head);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return (void *)aux[AT_ENTRY];
|
return (void *)aux[AT_ENTRY];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue