https://bugs.winehq.org/show_bug.cgi?id=52159
Bug ID: 52159 Summary: 64-bit cygwin gdb.exe and python3.8.exe fail to run Product: Wine Version: 6.22 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 71205 --> https://bugs.winehq.org/attachment.cgi?id=71205 details.txt
This issue can be seen if the workarounds for bug #47808 got applied first.
Both gdb.exe and python3.8.exe fail in the python initialisation.
As far as I see it python allocates 8 bytes for a sem_t structure. This uninitialized struct is given to sem_init which checks if this is a previously initialized semaphore by checking with verifyable_object_isvalid. This check happens inside a __try/__endtry [2] [3].
That way we end up in RtlUnwindEx, which inspects NtCurrentTeb()->Tib.ExceptionList. Unfortunately this list finally contains a pointer to the initial stack, which cygwin deallocated before [1].
See details.txt.
https://bugs.winehq.org/show_bug.cgi?id=52159
--- Comment #1 from Bernhard Übelacker bernhardu@mailbox.org --- Created attachment 71208 --> https://bugs.winehq.org/attachment.cgi?id=71208 Workaround by ignoring pointers outside of the current stack.
Forgot to mention that the patches for bug #52105 are also needed to get to that issue.
Attached patch ignores pointers that are outside of the current stack.
That made gdb.exe working that far that I can debug gdb.exe with it :-)
https://bugs.winehq.org/show_bug.cgi?id=52159
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on| |47808, 52105
https://bugs.winehq.org/show_bug.cgi?id=52159
Jinoh Kang jinoh.kang.kr@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jinoh.kang.kr@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=52159
Joel Holdsworth joel@airwebreathe.org.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |joel@airwebreathe.org.uk
https://bugs.winehq.org/show_bug.cgi?id=52159
--- Comment #2 from Joel Holdsworth joel@airwebreathe.org.uk --- Are we saying that the stack bug and this bug are really bugs in Cygwin?
Of course in principle, Wine ought to run and piece of Windows software - even if it is buggy.
However, in practice, isn't it Cygwin's fault for reallocating the stack, and leaving stale pointers in ExceptionList?
And isn't it Cywin's fault for assuming the Windows dlls will never step the stack pointer over the guard pages?
Maybe one day these things could be handled in Wine, but for now, perhaps it would be better to make fixes for Cygwin.
Also the cygwin FAST_CWD code making assumptions about Windows executable code.
https://bugs.winehq.org/show_bug.cgi?id=52159
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com
--- Comment #3 from Zeb Figura z.figura12@gmail.com --- (In reply to Joel Holdsworth from comment #2)
Are we saying that the stack bug and this bug are really bugs in Cygwin?
Of course in principle, Wine ought to run and piece of Windows software - even if it is buggy.
However, in practice, isn't it Cygwin's fault for reallocating the stack, and leaving stale pointers in ExceptionList?
No, Cygwin is fine here. The TIB list isn't supposed to be used on x86_64 at all; we use it because we can't easily generate SEH exception information.
And isn't it Cywin's fault for assuming the Windows dlls will never step the stack pointer over the guard pages?
No, that's part of the ABI; you're supposed to touch the guard pages first. The default stack on Windows is also split into reserved and committed portions; we just don't do that on Wine for some reason (possibly this one).
Maybe one day these things could be handled in Wine, but for now, perhaps it would be better to make fixes for Cygwin.
Also the cygwin FAST_CWD code making assumptions about Windows executable code.
That on the other hand is something Cygwin shouldn't do.
Although, if I had to take my pick, I'd like Cygwin to stop abusing alloca() as in bug 47812.
https://bugs.winehq.org/show_bug.cgi?id=52159
--- Comment #4 from Joel Holdsworth joel@airwebreathe.org.uk --- This seems to be working with Msys2 mingw64 python3.10.exe - can anyone else confirm?
wine64 /path/to/msys64/mingw64/bin/python3.10.exe ^M007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 Python 3.10.5 (main, Jun 18 2022, 01:16:30) [GCC 12.1.0 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
print("Hello")
Hello
quit()
https://bugs.winehq.org/show_bug.cgi?id=52159 Bug 52159 depends on bug 47808, which changed state.
Bug 47808 Summary: Cygwin's mintty.exe crashes with a stack overflow https://bugs.winehq.org/show_bug.cgi?id=47808
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED
https://bugs.winehq.org/show_bug.cgi?id=52159
--- Comment #5 from Bernhard Übelacker bernhardu@mailbox.org --- Hello, unfortunately I still see this issue here. (`python3.11` and `gdb -q --args gdb`) The previously attached workaround patch still makes it disappear.
$ WINEDEBUG=+pid LANG=C wine "C:\msys64\usr\bin\bash.exe" --login -c "python3.11" ... wine: Unhandled page fault on write access to 0000000067DF7300 at address 0000000180217C56 (thread 0120), starting debugger... 01cc:01d0:err:virtual:virtual_setup_exception stack overflow 1808 bytes addr 0x170056927 stack 0x67c008f0 (0x67c00000-0x67c01000-0x67e00000)
https://bugs.winehq.org/show_bug.cgi?id=52159
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|64-bit cygwin gdb.exe and |cygwin/msys2: Unhandled |python3.8.exe fail to run |page fault in 64-bit | |gdb.exe and python3.8.exe Distribution|--- |Debian
https://bugs.winehq.org/show_bug.cgi?id=52159
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Fixed by SHA1| |a82238fad52761114ab2488d422 | |fad3f70dbb854
--- Comment #6 from Bernhard Übelacker bernhardu@mailbox.org --- I retested now with wine-9.0-rc3 and could no longer find this stack overflow. With the winehq devel packages it looks like it got fixed between 8.10 and 8.11. A bisect between this two versions shows a82238fad as the fixing commit.
https://bugs.winehq.org/show_bug.cgi?id=52159
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.0-rc4.
https://bugs.winehq.org/show_bug.cgi?id=52159 Bug 52159 depends on bug 52105, which changed state.
Bug 52105 Summary: Cygwin setup hangs (handle to \Device\NamedPipe\ used as the RootDirectory for NtCreateNamedPipeFile) https://bugs.winehq.org/show_bug.cgi?id=52105
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED