https://bugs.winehq.org/show_bug.cgi?id=48407
Bug ID: 48407 Summary: OllyDbg 2.x segfaults the process after attaching to it Product: Wine Version: 5.0-rc3 Hardware: x86 URL: http://www.ollydbg.de/odbg201.zip OS: Linux Status: NEW Keywords: regression Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: gabrielopcode@gmail.com CC: jacek@codeweavers.com Regression SHA1: 4ee629a3bafb1408a4e567908fef949837a39f10 Distribution: ---
Since commit 4ee629a3bafb1408a4e567908fef949837a39f10, OllyDbg will hang after attaching to a process while the process itself will crash, and the message `Segmentation fault' is printed in the terminal where the process is launched from (not OllyDbg).
How to reproduce after downloading OllyDbg (link provided in report) using a 32-bit prefix:
1) Launch a simple window app, such as `winemine' 2) From another terminal, launch OllyDbg in same prefix.
Optionally: To speed up the attaching in OllyDbg, go to Options->Options->Analysis. In `Automatic Module Analysis' set it to `Off'.
3) In OllyDbg, go to File->Attach and select the process (winemine). Wait a few seconds until modules are processed, then the process will segfault and OllyDbg will hang.
I tried to debug this to no avail, it's very unfamiliar territory for me, so it's a bit over my head.
Reverting that commit on current wine git is not easy and I don't know how to do it, since the break_process and related functions have been removed from the wineserver at some point. So unfortunately I don't know where to start to fix this regression.
https://bugs.winehq.org/show_bug.cgi?id=48407
--- Comment #1 from Jacek Caban jacek@codeweavers.com --- Created attachment 66185 --> https://bugs.winehq.org/attachment.cgi?id=66185 hack
The problem is that OllyDbg tries to set PAGE_GUARD protection on whole ntdll code. This can't work with current design because we need to be able to execute signals to handle it and signal handlers themselves are protected. The unrecoverable page fault happens in this case on return from mprotect to ntdll.
The attached hack works around the problem. I didn't look why it worked before (my guess is that the problematic protection change is part of the initial breakpoint exception and before the patch, simulated breakpoint was not considered as this "special iniial" one; that would match the difference the patch made for VS). The path forward is to move ntdll to PE lib + native lib hybrid. I imagine that page guard related signal handling will not reach PE part in this case.
https://bugs.winehq.org/show_bug.cgi?id=48407
--- Comment #2 from Gabriel Ivăncescu gabrielopcode@gmail.com --- Thanks for looking into the bug. Indeed, the hack solves the problem (for now). Just wondering, would this hack be suitable for wine-staging meanwhile?
https://bugs.winehq.org/show_bug.cgi?id=48407
--- Comment #3 from Jacek Caban jacek@codeweavers.com --- It doesn't seem like a good candidate for staging to me. This hack is not something that could be improved while being staged. We need a very different approach for Wine.
https://bugs.winehq.org/show_bug.cgi?id=48407
Jacek Caban jacek@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |c96ef78b6d6d9184d8ec4cd1892 | |4a3049d388583
--- Comment #4 from Jacek Caban jacek@codeweavers.com --- This is fixed in current git. Commit c96ef78b6d6d9184d8ec4cd18924a3049d388583 seems like the most likely fix (not verified).
https://bugs.winehq.org/show_bug.cgi?id=48407
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |ntdll
https://bugs.winehq.org/show_bug.cgi?id=48407
--- Comment #5 from Gabriel Ivăncescu gabrielopcode@gmail.com --- I confirm this is fixed. Thanks.
https://bugs.winehq.org/show_bug.cgi?id=48407
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.17.
https://bugs.winehq.org/show_bug.cgi?id=48407
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|http://www.ollydbg.de/odbg2 |https://web.archive.org/web |01.zip |/20140209193012/http://olly | |dbg.de/odbg201.zip Keywords| |download CC| |focht@gmx.net