svn commit: r304012 - head/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Fri Aug 12 18:31:45 UTC 2016


Author: kib
Date: Fri Aug 12 18:31:44 2016
New Revision: 304012
URL: https://svnweb.freebsd.org/changeset/base/304012

Log:
  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

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Fri Aug 12 18:29:11 2016	(r304011)
+++ head/libexec/rtld-elf/rtld.c	Fri Aug 12 18:31:44 2016	(r304012)
@@ -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 *
 
 	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);


More information about the svn-src-all mailing list