[Bug sanitizer/81493] python fails to load libtsan.so: cannot allocate memory in static TLS block
wangzhijun2005 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 21 04:08:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81493
wangzhijun2005 at hotmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
--- Comment #5 from wangzhijun2005 at hotmail dot com ---
I also tried to link my library with static Thread sanitizer libtsan.a, then
loaded it without setting LD_PRELOAD , still got error "libfoo.so: cannot
allocate memory in static TLS block". But it works for Address Sanitizer in
this way.
$ cat foo.c
#include <stdint.h>
#include <stdio.h>
__thread uint64_t foo = 1;
void bar(void)
{
printf("address of foo: %p\n", &foo);
return;
}
$ gcc -O1 -fsanitize=thread -g -v -fno-omit-frame-pointer -L/home/gmdb/lib
-Wall -shared -fPIC -lpthread -o libfoo.so foo.c
$ ./try.py
Traceback (most recent call last):
File "./try.py", line 3, in <module>
CDLL("/home/gmdb/tls_bug/libfoo.so")
File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/gmdb/tls_bug/libfoo.so: cannot allocate memory in static TLS
block
$ ldd libfoo.so
linux-vdso.so.1 => (0x00007fff83c74000)
libachk.so => /lib/libachk.so (0x00007f4fc62df000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4fc60db000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f4fc5ebe000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4fc5bb5000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f4fc599e000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4fc55d5000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4fc53cd000)
/lib64/ld-linux-x86-64.so.2 (0x000055f5f5b35000)
More information about the Gcc-bugs
mailing list