https://bugs.winehq.org/show_bug.cgi?id=46236
Bug ID: 46236 Summary: Far 3.0 x64 crashes starting from build 5200 Product: Wine Version: 3.21 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: mail@chatty.de Distribution: ---
Created attachment 62932 --> https://bugs.winehq.org/attachment.cgi?id=62932 Build 5199 runs fine.
Starting from build 5200 Far 3.0 x64 crashes at startup.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #1 from Chatty mail@chatty.de --- Created attachment 62933 --> https://bugs.winehq.org/attachment.cgi?id=62933 Starting with build 5200 Far 3.0 x64 crashes.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #2 from Chatty mail@chatty.de --- https://farmanager.com/nightly/Far30b5199.x64.20180501.7z https://farmanager.com/nightly/Far30b5200.x64.20180502.7z
https://bugs.winehq.org/show_bug.cgi?id=46236
Chatty mail@chatty.de changed:
What |Removed |Added ---------------------------------------------------------------------------- OS|Linux |Mac OS X Hardware|x86 |x86-64 URL| |https://farmanager.com/nigh | |tly/Far30b5200.x64.20180502 | |.7z
https://bugs.winehq.org/show_bug.cgi?id=46236
Chatty mail@chatty.de changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=46237
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #3 from Chatty mail@chatty.de --- I guess the first four commits led to 5200: https://github.com/FarGroup/FarManager/commits/master?after=14ec294518231462...
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #4 from Chatty mail@chatty.de --- Created attachment 62958 --> https://bugs.winehq.org/attachment.cgi?id=62958 5200 still crashes with Wine 4.0-rc1
Updating to Wine-4.0-rc1 still produces the same SEH.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #5 from Artem S. Tashkinov aros@gmx.com --- Created attachment 62974 --> https://bugs.winehq.org/attachment.cgi?id=62974 Far Manager v3.0 build 5300 x86 crashing in Wine-4.0-rc1
I can confirm this. https://www.farmanager.com/files/Far30b5300.x86.20181029.msi crashes for me as well.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #6 from Artem S. Tashkinov aros@gmx.com --- I guess either this bug or its i686 brother (bug 46237) should be marked as a duplicate.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #7 from Chatty mail@chatty.de --- It's not a duplicate! This bug is about some change from build 5199 to 5200 which makes only the 64bit version crash on MacOS. No later x64 version is able to run.
OFF TOPIC: The x86 bug can be avoided by running Far with parameter "/w-" up to the latest build.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #8 from Artem S. Tashkinov aros@gmx.com --- (In reply to Chatty from comment #7)
It's not a duplicate! This bug is about some change from build 5199 to 5200 which makes only the 64bit version crash on MacOS. No later x64 version is able to run.
OFF TOPIC: The x86 bug can be avoided by running Far with parameter "/w-" up to the latest build.
It's a duplicate in a sense that you've filed two separate bug reports about the same issue which affects x86 and x86-64 Wine architectures. That wasn't necessary - one bug report will perfectly suffice.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #9 from Chatty mail@chatty.de --- It's not about the same issue! Only the x64 version crashes with a SEH due to some Far code which I encircled in comment 3 here. The x86 is not affected.
OFF TOPIC: The other bug is probably affecting both architectures which I cannot confirm until this bug has been solved. But in any case it's a crash due to totally different code. The only overlap is the name of the affected program.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #10 from Chatty mail@chatty.de --- 5200 x64 upwards still crashes with Wine 4.0-rc2
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #11 from Chatty mail@chatty.de --- 5200 x64 upwards still crashes with Wine 4.0-rc4
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #12 from Chatty mail@chatty.de --- 5200 x64 upwards still crashes with Wine 4.0-rc6
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #13 from Chatty mail@chatty.de --- With joined efforts Alex Alabuzhev and I have tracked the issue further down.
From build 5200 upwards they changed from gcc to VS2015, later VS2017. The
Microsoft compiler handles thread initialization differently in x64 leading to the above described SEH.
One workaround is to compile Far x64 with gcc, then the original code work up to the latest build (5356 at the moment).
Another workaround is to disable the window thread initialized in wm_listener::Check() - just insert return as first instruction. According to Alex it's not important on a Mac. Then Far x64 can be started also up to the latest build but immediately an exception occurs also pointing at thread initialization within MSVCRT. So back to workaround one.
To clarify: Far x64 (or any similar multithreaded app) compiled with VS201x used with Mac-Wine is the only combination affected. Bug title should be changed to "x64 multithreading compiled with VS201x raises SEH (example Far x64)".
https://bugs.winehq.org/show_bug.cgi?id=46236
Chatty mail@chatty.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |win64
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #14 from Ken Thomases ken@codeweavers.com --- That suggests to me that this is hitting a limitation of the 64-bit support on macOS. There's a technical barrier to properly supporting 64-bit Windows apps on macOS. Wine has a partial workaround, but there are still cases that won't work.[1]
It seems like this program, when compiled by VS2017, is hitting one of those cases. That may be because of different code being emitted by the compiler or because of different code in one or more statically linked libraries.
[1] https://stackoverflow.com/questions/53244454/how-did-wine64-manage-to-handle...
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #15 from Chatty mail@chatty.de --- Here are two different artifacts of the same code:
Compiled by gcc: https://ci.appveyor.com/api/buildjobs/g9jqbgsh5rjxqbkg/artifacts/Far.x64.3.0...
Compiled by VS2017: https://www.farmanager.com/nightly/Far30b5356.x64.20190202.7z
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #16 from Chatty mail@chatty.de --- I could finally spot the root cause with the help of Alex:
This little piece of code compiled with /MT (instead of default /MD) causes x64 code to crash on a Mac (x86 or Linux is not affected):
struct s { static unsigned WINAPI func(void* Param) { std::wcout << (const wchar_t*)Param; return 0; } }; _beginthreadex(nullptr, 0, &s::func, (void*)L"Test", 0, 0); Sleep(1000);
More info on the compiler parameter: https://docs.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library...
https://bugs.winehq.org/show_bug.cgi?id=46236
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ken@codeweavers.com
--- Comment #17 from Ken Thomases ken@codeweavers.com --- Created attachment 63691 --> https://bugs.winehq.org/attachment.cgi?id=63691 Hack to enable TEB->PEB access via %gs:0x60
(In reply to Chatty from comment #16)
I could finally spot the root cause with the help of Alex:
This little piece of code compiled with /MT (instead of default /MD) causes x64 code to crash on a Mac (x86 or Linux is not affected):
struct s { static unsigned WINAPI func(void* Param) { std::wcout << (const wchar_t*)Param; return 0; } }; _beginthreadex(nullptr, 0, &s::func, (void*)L"Test", 0, 0); Sleep(1000);
More info on the compiler parameter: https://docs.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time- library?view=vs-2017
Those docs say that different libraries are linked depending on that compiler switch. Presumably, one library has an inlined access to some field of the TEB structure which our workaround doesn't support while the other library does not.
I'm attaching a gross hack that might help, depending on exactly which field of the TEB the library tries to access. If it's the Peb field, then this should help. Otherwise, not so much.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #18 from Chatty mail@chatty.de --- Created attachment 63703 --> https://bugs.winehq.org/attachment.cgi?id=63703 ConsoleApp compiled with MT and MD
Unfortunately I'm not compiling Wine from source. And you might be faster checking yourself different patches thus I compiled a small console app for you with /MT (crashing) and /MD (working) flag. If the thread succeeds to run it outputs "Test" and the program closes after 5 seconds otherwise it crashes when thread wants to start.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #19 from Chatty mail@chatty.de --- Wine 4.3 is still affected.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #20 from Artem S. Tashkinov aros@gmx.com --- I can't reproduce this bug in Wine 4.18 and Far Manager Far30b5454.x64.20190823.msi
Please retest.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #21 from Artem S. Tashkinov aros@gmx.com --- Since the original reporter is missing, I guess this bug report might be closed.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #22 from Chatty mail@chatty.de --- I don't own the affected hardware at the moment. If you want to close it, go ahead. I'll file a new bug if I happen to retest it in the future.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #23 from Artem S. Tashkinov aros@gmx.com --- (In reply to Chatty from comment #22)
I don't own the affected hardware at the moment. If you want to close it, go ahead. I'll file a new bug if I happen to retest it in the future.
This bug report has nothing to do with HW.
If you have a x86-64 Linux distro installed you can test it.
You can even test in in any Windows 64 distro by installing Linux 64 in e.g. VirtualBox.
https://bugs.winehq.org/show_bug.cgi?id=46236
--- Comment #24 from Artem S. Tashkinov aros@gmx.com --- This bug has been long solved.
https://bugs.winehq.org/show_bug.cgi?id=46236
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #25 from Austin English austinenglish@gmail.com --- (In reply to Artem S. Tashkinov from comment #24)
This bug has been long solved.
Fixed.
https://bugs.winehq.org/show_bug.cgi?id=46236
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #26 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.0-rc1.