SIGSEGV: exceptions with thread specific data

H.J. Lu hjl@lucon.org
Tue Mar 16 09:16:00 GMT 1999


The bug is in egcs. The problem is we share one data structure for
EH frame info. When we have more than one thread, we will have
trouble. When a thread throws an exception, it will modify the
global EH frame info with the return from malloc, which is thread
specific. Later on, another thread may cleanup the global EH frame
info upon exit. It will call free on the memory malloced by the
other thread. It won't work.

I don't know what the best way to fix it is. We may do

1. Free those EH frame info data within the thread which throwed the
exception and malloced those memory right after they are used. Or
2. Use global malloc/free for the global EH frame info. Or
3. Use the thread specific EH frame info. Or
4. Modify glibc to handle this special case.

I prefer #1 if it can work. It may work with some modifications to
frame.c and libgcc2.c. Also I don't know what will happen if 2 threads
throw exceptions at the same time. 

-- 
H.J. Lu (hjl@gnu.org)


More information about the Gcc-bugs mailing list