ramosian-glider / memory-sanitizer

Automatically exported from code.google.com/p/memory-sanitizer
0 stars 0 forks source link

segfault in msan_init while running unit_tests #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I tried to run it with unit_tests natively and see a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x00007f5e9330f4eb in __msan_init () at 
../projects/compiler-rt/lib/msan/msan.cc:287
287     ../projects/compiler-rt/lib/msan/msan.cc: No such file or directory.

(gdb) x/10i 0x7f5e9330f4e0
   0x7f5e9330f4e0 <__msan_init()>:      push   %r15
   0x7f5e9330f4e2 <__msan_init()+2>:    push   %r14
   0x7f5e9330f4e4 <__msan_init()+4>:    push   %r12
   0x7f5e9330f4e6 <__msan_init()+6>:    push   %rbx
   0x7f5e9330f4e7 <__msan_init()+7>:    sub    $0x28,%rsp
=> 0x7f5e9330f4eb <__msan_init()+11>:   cmpl   $0x0,-0x6f58c672(%rip)        # 
0x7f5e23d82e80
   0x7f5e9330f4f2 <__msan_init()+18>:   jne    0x7f5e9330f7ba <__msan_init()+730>
   0x7f5e9330f4f8 <__msan_init()+24>:   movb   $0x1,-0x6f58c67b(%rip)        # 0x7f5e23d82e84
   0x7f5e9330f4ff <__msan_init()+31>:   lea    0x65af3fcc(%rip),%rax        # 0x7f5ef8e034d2 <.L.str4>
   0x7f5e9330f506 <__msan_init()+38>:   mov    0x6a5297f3(%rip),%rcx        # 0x7f5efd838d00

(gdb) info proc map
process 1481
Mapped address spaces:

          Start Addr           End Addr       Size     Offset objfile
      0x7f5e84f93000     0x7f5e84f98000     0x5000        0x0 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
      0x7f5e84f98000     0x7f5e85197000   0x1ff000     0x5000 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
      0x7f5e85197000     0x7f5e85198000     0x1000     0x4000 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0

It seems there is no memory at 0x7f5e23d82e80

In a different run:
It looks like the the address calcuation is wrong? the whole executable seems 
is there.
(gdb) x/10i __msan_init
   0x7f11e33b84e0 <__msan_init()>:      push   %r15
   0x7f11e33b84e2 <__msan_init()+2>:    push   %r14
   0x7f11e33b84e4 <__msan_init()+4>:    push   %r12
   0x7f11e33b84e6 <__msan_init()+6>:    push   %rbx
   0x7f11e33b84e7 <__msan_init()+7>:    sub    $0x28,%rsp
=> 0x7f11e33b84eb <__msan_init()+11>:   cmpl   $0x0,-0x6f58c672(%rip)        # 
0x7f1173e2be80

(gdb) info proc mapping
process 32642
Mapped address spaces:

          Start Addr           End Addr       Size     Offset objfile
      0x7f11d503c000     0x7f11d5041000     0x5000        0x0 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
      ...
      0x7f11e2893000     0x7f124d426000 0x6ab93000        0x0 /usr/local/google/home/zhaoqin/Workspace/Chrome/chromium.git/src/out/Debug/unit_tests
      0x7f124d426000     0x7f124d90c000   0x4e6000 0x6ab92000 /usr/local/google/home/zhaoqin/Workspace/Chrome/chromium.git/src/out/Debug/unit_tests
      0x7f124d90c000     0x7f1273e2c000 0x26520000 0x6b078000 /usr/local/google/home/zhaoqin/Workspace/Chrome/chromium.git/src/out/Debug/unit_tests
      0x7f1273e2c000     0x7f12762c2000  0x2496000        0x0
      0x7fff905ca000     0x7fff905eb000    0x21000        0x0 [stack]
      0x7fff905ff000     0x7fff90600000     0x1000        0x0 [vdso]
    0xffffffffff600000 0xffffffffff601000     0x1000        0x0 [vsyscall]

Original issue reported on code.google.com by zhao...@google.com on 2 Dec 2013 at 3:43

GoogleCodeExporter commented 9 years ago
I can't reproduce this. Please provide more details. How do you build this 
binary?

Original comment by euge...@google.com on 3 Dec 2013 at 12:30

GoogleCodeExporter commented 9 years ago
This is an overflow of R_X86_64_PC32 relocation.
Debug-mode unit_tests with MSan are _that_ big.
As a workaround, use Release. AFAIK, it includes -gline-tables-only which makes 
it more or less debuggable.

Original comment by euge...@google.com on 4 Dec 2013 at 10:48

GoogleCodeExporter commented 9 years ago
Adding Project:MemorySanitizer as part of GitHub migration.

Original comment by gli...@google.com on 30 Jul 2015 at 9:22