fritzkink
2023-12-26 c3a1193deaa3a46b90c82aa59a5acf9cff2942b4
commit | author | age
c3a119 1 Solaris ELF objects can contain additional DTrace related .data section,
F 2 which can confuse Valgrind.
3
4 Previously, this was handled by detecting an ELF section outside all
5 mapped regions. However, it seems that even this DTrace related section
6 can be mapped into an existing region. This patch changes this detection
7 such that section mapping is no longer relevant.
8
9 Original fix:
10 https://sourceware.org/git/?p=valgrind.git;h=6260274e4ed84f02d3fbe73adbd3b65893e73bd8
11
12 Should be reported upstream.
13
14 --- valgrind-3.22.0/coregrind/m_debuginfo/readelf.c
15 +++ valgrind-3.22.0/coregrind/m_debuginfo/readelf.c
16 @@ -2153,17 +2153,24 @@ Bool ML_(read_elf_debug_info) ( struct _
17                       }
18                    }
19                 }
20 -               if (!loaded) {
21 -#                 if defined(SOLARIS_PT_SUNDWTRACE_THRP)
22 -                  if ((a_phdr.p_memsz == VKI_PT_SUNWDTRACE_SIZE)
23 -                     && ((a_phdr.p_flags & (PF_R | PF_W | PF_X)) == PF_R)) {
24 -                     TRACE_SYMTAB("PT_LOAD[%ld]:   ignore dtrace_data program "
25 -                                  "header\n", i);
26 -                     dtrace_data_vaddr = a_phdr.p_vaddr;
27 -                     continue;
28 +#              if defined(SOLARIS_PT_SUNDWTRACE_THRP)
29 +               if ((a_phdr.p_memsz == VKI_PT_SUNWDTRACE_SIZE)
30 +                  && ((a_phdr.p_flags & (PF_R | PF_W | PF_X)) == PF_R)) {
31 +                  if (dtrace_data_vaddr != 0) {
32 +                     ML_(symerr)(di, True, "Multiple dtrace_data headers detected");
33 +                     goto out;
34                    }
35 -#                 endif /* SOLARIS_PT_SUNDWTRACE_THRP */
36 +                  dtrace_data_vaddr = a_phdr.p_vaddr;
37  
38 +                  /* DTrace related section might be outside all mapped regions. */
39 +                  if (!loaded) {
40 +                     TRACE_SYMTAB("PT_LOAD[%ld]:   ignore dtrace_data program "
41 +                                  "header\n", i);
42 +                     continue;
43 +                  }
44 +               }
45 +#              endif /* SOLARIS_PT_SUNDWTRACE_THRP */
46 +               if (!loaded) {
47                    ML_(symerr)(di, False,
48                                "ELF section outside all mapped regions");
49                    /* This problem might be solved by further memory mappings.
50