I have noticed that RtlCreateUserThread in dlls/ntdll.thread.c uses the following call
pthread_attr_setstack( &attr, teb->DeallocationStack, (char *)teb->Tib.StackBase - (char *)teb->DeallocationStack );
I have the source code from release 1.7.41.
I am working on a complex project that traces the execution of programs running in Wine (won't go into detail here). I have noticed problems in RtlCreateUserThread when services.exe is launched in my environment. Basically the call to pthread_create causes a SIGSEGV.
Let me make it clear that under ordinary conditions, Wine works fine.
Playing around with things, I note that if I change the call above to be pthread_attr_setstacksize(&attr, 0x10000), then I don't get the same problem.
My question is, why does the exact position of the stack need to be set in this way?