Fill phdr and phsize for rtld object. It is needed for

dl_iterate_phdr() reporting the correct values.

PR:	211367
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2016-08-12 18:31:44 +00:00
parent 20ee0f7112
commit 09944776b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=304012

View File

@ -1916,6 +1916,7 @@ static void
init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info)
{
Obj_Entry objtmp; /* Temporary rtld object */
const Elf_Ehdr *ehdr;
const Elf_Dyn *dyn_rpath;
const Elf_Dyn *dyn_soname;
const Elf_Dyn *dyn_runpath;
@ -1954,6 +1955,9 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info)
relocate_objects(&objtmp, true, &objtmp, 0, NULL);
}
ehdr = (Elf_Ehdr *)mapbase;
objtmp.phdr = (Elf_Phdr *)((char *)mapbase + ehdr->e_phoff);
objtmp.phsize = ehdr->e_phnum * sizeof(objtmp.phdr[0]);
/* Initialize the object list. */
TAILQ_INIT(&obj_list);