Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 255 by [email protected]: Forking threads fails with clang 3.4
http://code.google.com/p/address-sanitizer/issues/detail?id=255

I don't know what exactly is the source of the issue. I have a program that performs the following steps:
* fork 4 threads
* fork a new process
* fork 4 threads in the new process

The parent process performs some work before this that involves:
* (un)poisoning some memory
* handling some segv

Forking the new threads in the child process ends with the following errors (in every single thread):

=================================================================
==8377==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f9922ffdf28 at pc 0x4606d1 bp 0x7f9922ffdf00 sp 0x7f9922ffded8
WRITE of size 8 at 0x7f9922ffdf28 thread T7
==8377==AddressSanitizer: while reporting a bug found another one.Ignoring.
==8377==AddressSanitizer: while reporting a bug found another one.Ignoring.
#0 0x4606d0 in __interceptor_pthread_attr_getstack /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2549 #1 0x48d28a in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:77 #2 0x48d65d in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:248 #3 0x484ab3 in SetThreadStackAndTls /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:184 #4 0x484ab3 in __asan::AsanThread::Init() /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:142 #5 0x484cff in __asan::AsanThread::ThreadStart(unsigned long) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:157 #6 0x7f99296c8e0d in start_thread /home/aurel32/eglibc/eglibc-2.17/nptl/pthread_create.c:311
    #7 0x7f99287900fc (/lib/x86_64-linux-gnu/libc.so.6+0xe90fc)

==8377==AddressSanitizer CHECK failed: /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:231 "((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0) #0 0x4838ff in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_rtl.cc:66 #1 0x489161 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_common.cc:69 #2 0x484f7e in __asan::AsanThread::GetFrameNameByAddr(unsigned long, unsigned long*, unsigned long*) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:206 #3 0x48048f in __asan::DescribeAddressIfStack(unsigned long, unsigned long) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_report.cc:317 #4 0x480edc in __asan::DescribeAddress(unsigned long, unsigned long) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_report.cc:466 #5 0x481d01 in __asan_report_error /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_report.cc:775 #6 0x4606ee in __interceptor_pthread_attr_getstack /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:2549 #7 0x48d28a in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:77 #8 0x48d65d in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*) /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:248 #9 0x484ab3 in SetThreadStackAndTls /home/fruneau/dev/tools/llvm_3.4/projects/compiler-rt/lib/asan/asan_thread.cc:184

This has been tested with clang 3.4 and compiler-rt revision 197381 (branch release_34). The issue does not occur with clang 3.3. I can provide more details if needed.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to