Why does ntdll/thread.c use pthread_attr_setstack

Mate Antunovic just.mate.antunovic at gmail.com
Mon May 18 03:05:16 CDT 2015


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20150518/84adb345/attachment.html>


More information about the wine-devel mailing list