Fix aux_info corruption in rtld direct execution mode.

After the aux vector is moved, it is necessary to re-digest aux_info so the
pointers are updated to the new locations.

This was causing thread creation to fail on powerpc64 when using direct
execution due to a nonsense value being read for aux_info[AT_STACKPROT].

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D21656
This commit is contained in:
Brandon Bergren 2019-09-14 21:18:10 +00:00
parent b897b02c6c
commit d020b3ebde

View File

@ -499,6 +499,13 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
if (auxp->a_type == AT_NULL)
break;
}
/* Since the auxiliary vector has moved, redigest it. */
for (i = 0; i < AT_COUNT; i++)
aux_info[i] = NULL;
for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
if (auxp->a_type < AT_COUNT)
aux_info[auxp->a_type] = auxp;
}
} else {
_rtld_error("No binary");
rtld_die();