http://bugs.winehq.org/show_bug.cgi?id=24018
Andrey Turkin andrey.turkin@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andrey.turkin@gmail.com
--- Comment #9 from Andrey Turkin andrey.turkin@gmail.com 2013-05-29 01:27:34 CDT --- --- snip --- char *st = (char *) stacktop - 4096; while (_tlstop >= st) stackp = getstack (stackp); --- snip ---
This is a bug in Cygwin - this code is supposed to allocate stack to the same limits as in parent thread, but it touches 2 extra pages. This is usually not a problem in Windows where initial stack allocation is significantly less than stack limit; Wine pre-allocates whole stack instead and there is no extra space to go. This bug in Cygwin can be reproduced on Windows too with this program:
----- int main(void) { while(!fork()); return 0; } -----
It is supposed to be able to fork infinitely; on Cygwin it will fail rather quickly.
Wine probably should emulate Windows behavior and allocate as much stack space as requested by PE header; unfortunately, Windows approach (a single guard page) is not an option because Wine code and *NIX libraries don't probe stack pages.