https://bugs.winehq.org/show_bug.cgi?id=55138
Bug ID: 55138 Summary: msys2: bash.exe is not able to fork/start another process. Product: Wine Version: 8.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: bernhardu@mailbox.org Distribution: ---
Created attachment 74697 --> https://bugs.winehq.org/attachment.cgi?id=74697 allocation stacks in parent and child bash.exe
This is a followup to bug 47808. If I understand it right, bug 47808 was primarily about native libraries getting called at a win32 stack which was not yet committed. Those native libraries then jumped over the guard page, therefore the stack got not grown, instead a crash reported. This aspect was fixed by using the syscall interface and therefore bug 47808 was closed.
But there is another issue that causes a msys2-forked process crashing, because after the stack was grown it still misses the PAGE_READWRITE flags.
For this Zeb Figura included in the first attachement to bug 47808 "always expand the stack if within the stack reserve" a line adding the flags "VPROT_COMMITTED | VPROT_READ | VPROT_WRITE" to the page that gets the VPROT_GUARD removed in grow_thread_stack.
This modification still enables a forked process to run.
The issue can be reproduced with an unmodified wine by just - running msys2 bash.exe interactively - then trying to start e.g. notepad from it.
Attached file shows the stack when the stack gets allocated - in a working msys2-parent process and - in a failing msys2-forked child process.
Therefore it looks like the forked stack get really setup differently, but it is still not clear if or when this memory gets the READ/WRITE added in native windows.
https://bugs.winehq.org/show_bug.cgi?id=55138
Joel Holdsworth joel@airwebreathe.org.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |joel@airwebreathe.org.uk
https://bugs.winehq.org/show_bug.cgi?id=55138
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|msys2: bash.exe is not able |msys2/bash.exe: is not able |to fork/start another |to fork/start another |process. |process (cygwin/mintty: | |silently finishes, fails | |top open window) See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=47808
https://bugs.winehq.org/show_bug.cgi?id=55138
--- Comment #1 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 75738 --> https://bugs.winehq.org/attachment.cgi?id=75738 ntdll: Add read and write to new guard pages.
This makes also cygwin64 mintty silently fail to open the window.
It looks like cygwins child_info_fork::alloc_stack setups the stack with three guard pages. This pages end up with vprot bits 0x33 set (read,write,guard,committed). Below pages stay with having no vprot bits set.
The function grow_thread_stack seems to be able to grow the stack for these top three pages without problem. It is able to set vprot bit 0x30 to the next guard page (guard,committed).
Unfortunately on the next grow_thread_stack it changes the vprot bits to 0x20, and therefore get_unix_prot(0x20) returns prot=0, therefore the page looses its guard page status, but gets not committed. (mprotect is called with unix_prot=0)
Attached patch, adds always read,write to guard pages.
https://bugs.winehq.org/show_bug.cgi?id=55138
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
https://bugs.winehq.org/show_bug.cgi?id=55138
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #75738|0 |1 is obsolete| |
--- Comment #2 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 76702 --> https://bugs.winehq.org/attachment.cgi?id=76702 ntdll: Add read and write to new guard pages. (rebased wine-9.12)
Still present with wine-9.11.
Test was done with a wine tree including patches related to bug 52105.
https://bugs.winehq.org/show_bug.cgi?id=55138
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source
https://bugs.winehq.org/show_bug.cgi?id=55138
manschwetus@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |manschwetus@gmail.com