<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ASan should relocate its shadow region if the default location is claimed by something else"
   href="https://llvm.org/bugs/show_bug.cgi?id=25466">25466</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ASan should relocate its shadow region if the default location is claimed by something else
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jeremyhu@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As initially reported to me at
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=92876">https://bugs.freedesktop.org/show_bug.cgi?id=92876</a>

"""
$ /opt/wine/bin/wine /opt/wine/lib/wine/fakedlls/winemine.exe 
==16321==Shadow memory range interleaves with an existing memory mapping. ASan
cannot proceed correctly. ABORTING.
==16321==ASan shadow was supposed to be located in the [0x1ffff000-0x3fffffff]
range.
==16321==Process memory map follows:
    0x43c0d000-0x43c9f000   
/opt/X11/lib/asan/libclang_rt.asan_osx_dynamic.dylib
    0x43c9f000-0x44139000   
/opt/X11/lib/asan/libclang_rt.asan_osx_dynamic.dylib
    0x44139000-0x4417e000   
/opt/X11/lib/asan/libclang_rt.asan_osx_dynamic.dylib
    0x4384d000-0x43bb4000    /opt/X11/lib/libfreetype.6.dylib
    0x43bb4000-0x43bc3000    /opt/X11/lib/libfreetype.6.dylib
    0x43bc3000-0x43c0d000    /opt/X11/lib/libfreetype.6.dylib
    0x43720000-0x437dd000    /opt/wine-1.3.16/lib/wine/comctl32.dll.so
    0x437dd000-0x43808000    /opt/wine-1.3.16/lib/wine/comctl32.dll.so
    0x43808000-0x4384d000    /opt/wine-1.3.16/lib/wine/comctl32.dll.so
    0x434f7000-0x4359d000    /opt/wine-1.3.16/lib/wine/shell32.dll.so
    0x4359d000-0x436b6000    /opt/wine-1.3.16/lib/wine/shell32.dll.so
    0x436b6000-0x43720000    /opt/wine-1.3.16/lib/wine/shell32.dll.so
    0x43169000-0x431ba000    /opt/wine-1.3.16/lib/wine/shlwapi.dll.so
    0x431ba000-0x431c3000    /opt/wine-1.3.16/lib/wine/shlwapi.dll.so
    0x431c3000-0x431fe000    /opt/wine-1.3.16/lib/wine/shlwapi.dll.so
    0x433a5000-0x4347b000    /opt/wine-1.3.16/lib/wine/oleaut32.dll.so
    0x4347b000-0x43488000    /opt/wine-1.3.16/lib/wine/oleaut32.dll.so
    0x43488000-0x434f7000    /opt/wine-1.3.16/lib/wine/oleaut32.dll.so
    0x43300000-0x43364000    /opt/wine-1.3.16/lib/wine/rpcrt4.dll.so
    0x43364000-0x4336b000    /opt/wine-1.3.16/lib/wine/rpcrt4.dll.so
    0x4336b000-0x433a5000    /opt/wine-1.3.16/lib/wine/rpcrt4.dll.so
    0x41aa9000-0x41ac0000    /opt/wine-1.3.16/lib/wine/version.dll.so
    0x41ac0000-0x41ac1000    /opt/wine-1.3.16/lib/wine/version.dll.so
    0x41ac1000-0x41ac4000    /opt/wine-1.3.16/lib/wine/version.dll.so
[... the process memory map is too long for bugzilla, so I cut it here ...]
==16320==End of process memory map.
fixme:ntdll:RtlNtStatusToDosErrorNoTeb no mapping for 80000101

The full error message (with full process map) can be found here:
<a href="https://www.dropbox.com/s/ynhmvn8qx03n73j/wine-xquartz.txt?dl=0">https://www.dropbox.com/s/ynhmvn8qx03n73j/wine-xquartz.txt?dl=0</a>
"""

The issue seems to be that wine's WINE_DOS segment conflicts with ASan's
shadow:

    0x00000000-0x40000000    /opt/wine/bin/wine.bin

Load command 3
      cmd LC_SEGMENT
  cmdsize 124
  segname WINE_DOS
   vmaddr 0x00001000
   vmsize 0x40000000
  fileoff 0
 filesize 0
  maxprot 0x00000007
 initprot 0x00000003
   nsects 1
    flags 0x0
Section
  sectname WINE_DOS
   segname WINE_DOS
      addr 0x00001000
      size 0x40000000
    offset 0
     align 2^0 (1)
    reloff 0
    nreloc 0
     flags 0x00000001
 reserved1 0
 reserved2 0</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>