cynthia / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Incompatible with non-standard stacks (Boost.Context) #435

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build any program that uses Boost.Context and link with tcmalloc
2.  - example: https://github.com/bytemaster/mace
3.

What is the expected output? What do you see instead?
I expected things to run.  

It crashed with:
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff6a5a0ff8

VM Regions Near 0x7fff6a5a0ff8:
    MALLOC_TINY            00007fdc81c00000-00007fdc81d00000 [ 1024K] rw-/rwx SM=PRV  
--> STACK GUARD            00007fff66da1000-00007fff6a5a1000 [ 56.0M] ---/rwx 
SM=NUL  stack guard for thread 0
    Stack                  00007fff6a5a1000-00007fff6ada1000 [ 8192K] rw-/rwx SM=COW  thread 0

Application Specific Information:
dyld: launch, running initializers
/usr/local/lib/libtcmalloc.4.dylib

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libgcc_s.1.dylib                0x000000010b4a9d78 __emutls_get_address + 8
1   libtcmalloc.4.dylib             0x000000010b290138 tc_calloc + 296
2   libsystem_c.dylib               0x00007fff95266346 malloc_zone_calloc + 81
3   libsystem_c.dylib               0x00007fff9526715d calloc + 48
4   libgcc_s.1.dylib                0x000000010b4a9eec __emutls_get_address + 380

What version of the product are you using? On what operating system?
Mac OS X 10.7 gperftools-2.0

Please provide any additional information below.

Original issue reported on code.google.com by dlari...@gmail.com on 3 Jun 2012 at 9:23

GoogleCodeExporter commented 9 years ago
Looks related to tls. Consider applying the following change on current trunk:

diff --git a/configure.ac b/configure.ac
index 033f224..b19fc10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,6 +306,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && 
(defined(__i386__) ||
 #if defined(__MINGW32__)
 #error mingw doesn't really support tls
 #endif
+#error Testing this
 ], [static __thread int p = 0])],
                [AC_DEFINE(HAVE_TLS, 1,
                           Define to 1 if compiler supports __thread)

Original comment by alkondratenko on 7 Jul 2013 at 12:17

GoogleCodeExporter commented 9 years ago
Patch proposed above was recently merged. But I still have no idea of OSX 
doesn't use stack point to find thread local storage area (many years ago Linux 
threading package was doing that).

But without test program I cannot really say if it works or not.

Closing as obsolete. Please reopen if problem still occurs. Preferably with 
test program (that non-osx-junkie like me can easily build).

Original comment by alkondratenko on 14 Sep 2013 at 8:24