Description of problem:
nptl thread segv's when killed
How reproducible: Sometimes
Steps to Reproduce:
1. run test code
Created attachment 120280 [details]
I haven't been able to reproduce it yet, but the testcase is certainly buggy.
None of the calls you make in sig_handler are allowed in signal handlers,
none of printf, exit, pthread_self and pthread_exit are async-signal safe
E.g. when thread_function enters pthread_exit call in it and a signal comes in,
a crash is very much expected.