Public bug reported: I've discovered that adding "static __thread anything[8 * 1048576]" to otherwise working programs will cause them to segfault. I've attached a short example that demonstrates the problem.
Compile the attached program like this: gcc -o test test.c -lpthread -lasound When running it, it will display this: Spawning thread... Joining thread... I'm a thread! Segmentation fault Unfortunately I haven't been able to figure out how to reproduce it without using libasound, except that I can use libjack to trigger it instead, but since that makes two independent libraries that have this problem, I assume it is caused by something common between them, like pthreads, GCC, or the Linux kernel. FWIW, with the Jack version of the bug, I've seen it do two things. With a larger allocation it displays messages about being unable to create threads before failing to connect to its server. With a smaller allocation, it connects to its server, but then segfaults later in a different call to libjack. In all cases, merely removing the "static __thread anything[8 * 1048576]" from the program causes the libraries to work correctly. Since the variable is never accessed by anything, adding it to the programs should have no effect. ** Affects: glibc (Ubuntu) Importance: Undecided Status: New ** Attachment added: "Short example demonstrating the problem." https://bugs.launchpad.net/bugs/1757517/+attachment/5086214/+files/test.c -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1757517 Title: An unused thread-local memory allocation can cause library calls to segfault. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1757517/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs