[Bug 50993] App compiled with address sanitizer don't work in Wine

WineHQ Bugzilla wine-bugs at winehq.org
Sun May 9 06:50:36 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=50993

--- Comment #4 from Roman Pišl <rpisl at seznam.cz> ---
Created attachment 69979
  --> https://bugs.winehq.org/attachment.cgi?id=69979
Fix for clang dynamic address sanitizer

My previous post is valid for ASAN with static runtime. For dynamic runtime
(/MD), additional instructions have to be added to GetInstructionSize().

But only that is not sufficient and ASAN initialization still fails. That is
due to FindAvailableMemoryRange() is looking for a large free block of virtual
address space but all available address space is marked as MEM_RESERVE in Wine.

So a following quick hack..

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
index 63c90785f270..b98cd78c55d4 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
@@ -372,8 +372,7 @@ uptr FindAvailableMemoryRange(uptr size, uptr alignment,
uptr left_padding,
     MEMORY_BASIC_INFORMATION info;
     if (!::VirtualQuery((void*)address, &info, sizeof(info)))
       return 0;
-
-    if (info.State == MEM_FREE) {
+    if (info.State == MEM_FREE || info.State == MEM_RESERVE) {
       uptr shadow_address = RoundUpTo((uptr)info.BaseAddress + left_padding,
                                       alignment);
       if (shadow_address + size < (uptr)info.BaseAddress + info.RegionSize)

pushes it little bit forward although it still fails.

And now:
ASAN_OPTIONS=asan.log WINEDEBUG=+relay wine main.exe 2>/dev/null 
makes ASAN work and asan.log contains correct output.

Seems to me making ASAN work under Wine could be feasible..

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list