https://bugs.kde.org/show_bug.cgi?id=389412

            Bug ID: 389412
           Summary: Failed assertion in readelf.c, line 697 for clang
                    binaries with coverage information
           Product: valgrind
           Version: 3.13.0
          Platform: Compiled Sources
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: peter.klot...@gmail.com
  Target Milestone: ---

Approximately 1% of our internal regression tests show a failed assertion when
run with Valgrind 3.13.0:

  "valgrind: m_debuginfo/readelf.c:697 (get_elf_symbol_info): Assertion 'in_rx'
failed."

This only happens if the code is compiled with clang (5.0.1 on RHEL 7 x86_64)
together with coverage information options ("-fprofile-instr-generate
-fcoverage-mapping"). Valgrind runs fine without the coverage options or if gcc
is used. The problem occurs with the Google gold linker and also with the LLVM
lld linker.

We tracked it down to a single find_rx_mapping() call that returns 0 (via the
"return NULL" at the end of the method).

Call: find_rx_mapping(DebugInfo=0x100287C470, lo=3ef0e8, hi=42a0f7)

In a "readelf -aW" output the symbol causing the assertion seems to be
"__llvm_coverage_mapping":

  9458: 00000000003ef0e8 0x3b010 OBJECT  LOCAL  DEFAULT   33
__llvm_coverage_mapping
  9459: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS /.../SourceFile.cpp

Since variable "in_text" in get_elf_symbol_info() is true, the assertion
"vg_assert(in_rx);" fails.

Here a "--trace-symtab=yes" output from Valgrind:

----------------------
raw symbol [9453]: LOC FUN : svma 0x000042de90, sz   18 
__cxx_global_var_init.68
    rec(t) [9453]:            val 0x000042de90, sz   18 
__cxx_global_var_init.68
raw symbol [9454]: LOC FUN : svma 0x000042deb0, sz   18 
__cxx_global_var_init.69
    rec(t) [9454]:            val 0x000042deb0, sz   18 
__cxx_global_var_init.69
raw symbol [9455]: LOC FUN : svma 0x000042d6f0, sz   26 
__cxx_global_var_init.7
    rec(t) [9455]:            val 0x000042d6f0, sz   26 
__cxx_global_var_init.7
raw symbol [9456]: LOC FUN : svma 0x000042d710, sz   26 
__cxx_global_var_init.8
    rec(t) [9456]:            val 0x000042d710, sz   26 
__cxx_global_var_init.8
raw symbol [9457]: LOC FUN : svma 0x000042d730, sz   26 
__cxx_global_var_init.9
    rec(t) [9457]:            val 0x000042d730, sz   26 
__cxx_global_var_init.9
raw symbol [9458]: LOC OBJ : svma 0x00003ef0e8, sz 241680 
__llvm_coverage_mapping

valgrind: m_debuginfo/readelf.c:697 (get_elf_symbol_info): Assertion 'in_rx'
failed.
----------------------

Please let me know, if any additional information or further testing is needed.

Regards, Peter.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to