odyaka341 / thread-sanitizer

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

Segfault in __tsan_read4 #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
My program segfaults right after start. Here is backtrace. Any ideas?

marko@localhost:~/badoo/local/bmpid $ gdb -ex 'set disable-randomization off' 
--args ./bin/bmpid
Reading symbols from ./bin/bmpid...done.
(gdb) r
Starting program: /home/marko/badoo/local/bmpid/bin/bmpid
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fbf639b3700 (LWP 17604)]
Mar 05 18:07:26.060765 [WARNING] <17600> main.c:633 setup_unix_stuff(): 
setrlimit(CORE, unlimited) failed

Program received signal SIGSEGV, Segmentation fault.
__tsan_read4 (addr=0x28c) at 
../../../../libsanitizer/tsan/tsan_interface_inl.h:28
28    MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog4);
(gdb) bt
#0  __tsan_read4 (addr=0x28c) at 
../../../../libsanitizer/tsan/tsan_interface_inl.h:28
#1  0x00007fbf65d1b9ef in get_gnu_build_id () at ../misc/build_id.c:79
#2  0x00007fbf65d0aacf in main (argc=1, argv=0x7d040000f730, 
envp=0x7fff6153d218) at ../misc/main.c:1198

(gdb) up
#1  0x00007fbf65d1b9ef in get_gnu_build_id () at ../misc/build_id.c:79
79          if (note->n_namesz == sizeof("GNU") && note->n_type == NT_GNU_BUILD_ID) {

Original issue reported on code.google.com by marko@kevac.org on 5 Mar 2015 at 6:10

GoogleCodeExporter commented 9 years ago
Does the program segfault only under TSan? It looks like "note" is NULL.

Original comment by samso...@chromium.org on 5 Mar 2015 at 6:25

GoogleCodeExporter commented 9 years ago

Original comment by samso...@google.com on 5 Mar 2015 at 6:25

GoogleCodeExporter commented 9 years ago
> __tsan_read4 (addr=0x28c)

The program accesses address 0x28c. It is intended to crash.
If the program does not crash without tsan, it can be caused by usage of a 
different compiler. Do you use the same compiler with the same optimization 
level for both tsan and non-tsan build? If not, try to run with tsan compiler 
but w/o -fsanitize=thread. Also you can as well just debug tsan build with gdb 
and figure out where the 0x28c came from. Or run with asan/msan/ubsan.

Original comment by dvyu...@google.com on 6 Mar 2015 at 7:16

GoogleCodeExporter commented 9 years ago
Yeah, I was eager to open issue without proper investigation. It is true that 
program works without tsan, but this code does some hacky things. Sorry.

Original comment by marko@kevac.org on 6 Mar 2015 at 8:38