I just wanted to try to LD_PRELOAD the Intel TBB memory allocator proxy (c.f. https://software.intel.com/en-us/node/506097) to the arma3server in order to replace 'malloc()' and friends.
I'm working on a Ubuntu 12.04 (amd64) with lib32gcc1 and libc6:i386 installed.
However, my arma3server process segfaults with that LD_PRELOADING.
I digged into this and it seems like the LD_PRELOADing itself causes glibc's 'dlerror.c:init()' to be called fairly early.
That 'dlerror.c:init()' makes the first call to 'pthread_key_create()' which returns a key equal to '(pthread_key_t)0', i.e. the first one.
Later on, arma3server calls 'pthread_setspecific()' with the key parameter set to whatever is stored at address 0x9ae86c0.
The problem: address 0x9ae86c0 never gets written to (verified by a watchpoint in gdb). Since it is located in the .bss section, it gets initialized with zero.
Thus, in effect, arma3server sets a thread specific value for a key originally allocated within glibc's dl-framework.
Now, glibc's 'dlerror.c:_dlerror_run()' writes some internal stuff to the address stored at that key '(pthread_key_t)0'.
arma3server seems to expect some call tables to be located at the address stored at key '*(pthread_key_t*)0x9ae86c0 == (pthread_key_t)0'.
Thus, I get a segmentation fault whenever arma3server tries to follow one of these call tables overwritten by the glibc's dl-framework.
In the end, the bug is not to initialize the 'pthread_key_t' stored in .bss at 0x9ae86c0 (static variable?) by means of 'pthread_key_create()'.