I have found the problem and fix. NEW_STACK_SIZE for clone() should be increased from the default 16384 (x86_64) to 256 KiB.
On Tue, Apr 19, 2011 at 6:33 PM, Yale Zhang <yzhang1...@gmail.com> wrote: > Hi. I'm want to run some pthread programs using qemu userspace emulation > (target=i386, host=x86_64,arm), but see NPTL support isn't supported for the > i386 target. I have applied a patch from here > http://patchwork.ozlabs.org/patch/45206/ and used it to run a simple > pthread fork, join program. The program is able to launch multiple threads, > but the 1st thread that exits causes the program to crash inside the pthread > library. > > What are the reasons NPTL isn't supported for i386 and was it ever > supported in the past? I even wrote another simple program that does the > equivalent, but with using fork(), waitpid() instead of pthread_create(), > pthread_join(), and it works correctly. This seems to suggest thread local > storage wasn't implemented correctly? > > Thanks, > Yale > >