https://bugs.winehq.org/show_bug.cgi?id=49828
Bug ID: 49828 Summary: MSVC 2019 executables with ASAN enabled fail to start Product: Wine Version: 5.17 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: nyanpasu64@tuta.io Distribution: ---
Recent versions of MSVC allow building Windows .exes with ASAN (it may have already been possible using Clang.): https://devblogs.microsoft.com/cppblog/addresssanitizer-asan-for-windows-wit...
I took an old Win32/MFC application and built it using MSVC ASAN on Windows 10, to try to discover memory bugs on Windows and Wine.
- Program download at https://cdn.discordapp.com/attachments/653168829891084298/754540922972274790... . - Source at https://github.com/nyanpasu64/Dn-FamiTracker/tree/b3ba802f (permalink at https://cdn.discordapp.com/attachments/653168829891084298/754540828520611860... ). - To build, copy cmake_user_begin.cmake.example to cmake_user_begin.cmake, then run CMake in MSVC 32-bit Release mode. It may be possible using Visual Studio's .json file or msbuild, but I haven't tried yet.
On Windows, the program starts without problems. On wine-5.17, when I try to run this program, it crashes during the loading process.
nyanpasu64@dell-arch ~/apps> wine Dn_FamiTracker_ASAN.exe 0024:fixme:ntdll:EtwEventRegister ({6c6c766d-3846-4e6a-a4fb-5b530bd0f3fa}, 00401030, 00884590, 008845A8) stub. 0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0084A41C, 34) stub ==32==AddressSanitizer CHECK failed: D:\agent_work\3\s\src\vctools\crt\asan\llvm\compiler-rt\lib\asan\asan_rtl.cc:401 "((!asan_init_is_running && "ASan init calls itself!")) != (0)" (0x0, 0x0) <empty stack>
`winedbg Dn_FamiTracker_ASAN.exe` doesn't work, it gets stuck on `0x00000000005c9701 EntryPoint+0xffffffffffffffff in dn_famitracker_asan: ret`.
If I instead `winedbg --gdb Dn_FamiTracker_ASAN.exe`, I get a pile of identical SIGTRAP with different backtraces. These are non-fatal and can be continued. I think these correspond to asan errors that would normally terminate the program, but unfortunately it doesn't print log messages when running in winedbg. I don't know how to fix that.
0x005c9701 in _sanitizer_print_stack_trace () from /home/nyanpasu64/.wine/dosdevices/z:/home/nyanpasu64/apps/Dn_FamiTracker_ASAN.exe
The last SIGTRAP is different: 0x7bc52379 in DbgBreakPoint@0 () from /home/nyanpasu64/.wine/dosdevices/c:/windows/syswow64/ntdll.dll
Afterwards the program starts. (It used to crash, but works with lib32-libpulse and lib32-mpg123 installed, unsure if that's why.)