]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Runtime linker ld.so.1 can be now run under Valgrind on Solaris.
authorIvo Raisr <ivosh@ivosh.net>
Mon, 17 Aug 2015 19:13:12 +0000 (19:13 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Mon, 17 Aug 2015 19:13:12 +0000 (19:13 +0000)
Fixes BZ#351386.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15562

NEWS
coregrind/m_initimg/initimg-solaris.c
coregrind/m_ume/elf.c
coregrind/pub_core_ume.h

diff --git a/NEWS b/NEWS
index 6d661f90827b543cd3f4f25d40b4ab2bef1c022e..2c2ea7ca47f4c8a2ec4bb19c59b39697a21fe83d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -306,6 +306,7 @@ where XXXXXX is the bug number as listed below.
 350813  Use handwritten memcheck assembly helpers on x86/Solaris in addition to {arm,x86}-linux
 350854  hard-to-understand code in VG_(load_ELF)()
 351140  arm64 syscalls setuid (146) and setresgid (149) not implemented
+351386  Cannot run ld.so.1 under Valgrind
 n-i-bz  Provide implementations of certain compiler builtins to support
         compilers who may not provide those
 n-i-bz  Old STABS code is still being compiled, but never used. Remove it.
index 4db11a87fa225e73caedd05f985a07163ee06df0..49e4981e6a933ab84772ae4b42d74fda5f60ea7f 100644 (file)
@@ -367,7 +367,7 @@ static Addr setup_client_stack(void *init_sp,
 
       AT_SUN_PLATFORM
       AT_SUN_EXECNAME
-      AT_PHDR
+      AT_PHDR            (not for elfs with no PT_PHDR, such as ld.so.1)
       AT_BASE
       AT_FLAGS
       AT_PAGESZ
@@ -538,7 +538,7 @@ static Addr setup_client_stack(void *init_sp,
    auxv++;
 
    /* AT_PHDR */
-   if (info->phdr) {
+   if ((info->real_phdr_present) && (info->phdr != 0)) {
       auxv->a_type = VKI_AT_PHDR;
       auxv->a_un.a_val = info->phdr;
       auxv++;
index 93f28de315bc34db0dd0c6ee320841eba203cacb..af84fae1b0a8670100192b728bb9deec20b29d37 100644 (file)
@@ -350,6 +350,11 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
       if (ebase < hacky_load_address)
          ebase = hacky_load_address;
 #     endif
+
+#     if defined(VGO_solaris)
+      /* Record for later use in AT_BASE. */
+      info->interp_offset = ebase;
+#     endif
    }
 
    info->phnum = e->e.e_phnum;
@@ -363,6 +368,9 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
       switch(ph->p_type) {
       case PT_PHDR:
          info->phdr = ph->p_vaddr + ebase;
+#        if defined(VGO_solaris)
+         info->real_phdr_present = True;
+#        endif
          break;
 
       case PT_LOAD:
index d9f64918c89cb5d45e82fd990e0cf2519eec0a91..2fe97aa635a4b57a2a8bbecdcbfe2dffdadb80fc 100644 (file)
@@ -65,7 +65,8 @@ typedef
 #endif
 
 #if defined(VGO_solaris)
-      Addr  init_thrptr; // OUT: architecture-specific user per-thread location
+      Addr  init_thrptr;       // OUT: architecture-specific user per-thread location
+      Bool  real_phdr_present; // OUT: PT_PHDR found, include phdr in auxv
 #endif
 
       Addr entry;        // OUT: entrypoint in main executable