https://bugs.winehq.org/show_bug.cgi?id=46965
Bug ID: 46965 Summary: Stack overflow handling not working on x86_64 Product: Wine Version: 4.4 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: elpochodelagente@gmail.com Distribution: ---
Created attachment 64118 --> https://bugs.winehq.org/attachment.cgi?id=64118 stack overflow handling test case
The exception handler for stack overflows tries to use so much stack that it passes the guard page, causes a second stack overflow, and results in a fatal error. We found that this problem occurs in 64 bits but not in 32 bits, I guess because the 64-bit processor contexts are much fatter.
Our use case involves setting up a vectored interrupt handler, so that the stack overflow can be trapped and handled to continue doing something else. We didn't try using a structured exception handler.
We were not sure of how to fix the problem as the root of the crash is too much use of the stack, which the compiler owns. I was wondering if it was possible to put the contexts in the heap, but wasn't sure as there might be restrictions to exception handling code which I'm not aware of.
I attach a test case which works in 32-bits, and doesn't work in 64-bits.
$> i686-w64-mingw32-gcc -o stack-overflow-32.exe stack-overflow-1.c $> wine stack-overflow-32.exe exception! c00000fd stack overflow
$> x86_64-w64-mingw32-gcc -o stack-overflow-64.exe stack-overflow-1.c $> wine stack-overflow-64.exe 01ff:err:seh:setup_exception stack overflow 1552 bytes in thread 01ff eip 00007f3941e7a219 esp 0000000000131000 stack 0x130000-0x131000-0x330000
https://bugs.winehq.org/show_bug.cgi?id=46965
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |testcase CC| |dark.shadow4@web.de Status|UNCONFIRMED |NEW
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- Confirming. Thanks for the detailed bug report, really appreciate that.