<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/Win] Ignore allocations that occur before the dynamic runtime is initialized"
   href="https://llvm.org/bugs/show_bug.cgi?id=30903">30903</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ASan/Win] Ignore allocations that occur before the dynamic runtime is initialized
          </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>Windows NT
          </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>dmajor@mozilla.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>$ echo "int main() { return 0; }" > test.cpp
$ clang-cl -MD -fsanitize=address test.cpp
$ test.exe
=================================================================
==9112==ERROR: AddressSanitizer: attempting free on address which was not
malloc()-ed: 0x00bdaef0 in thread T0
    #0 0x650f6cca in free
d:\src\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cc:77
    #1 0x74670ba1 in destroy_fls (C:\Windows\System32\ucrtbase.dll+0x10030ba1)
    #2 0x772a9ec2 in RtlProcessFlsData
(C:\Windows\SYSTEM32\ntdll.dll+0x4b2a9ec2)
    #3 0x772aa142 in LdrShutdownProcess
(C:\Windows\SYSTEM32\ntdll.dll+0x4b2aa142)
    #4 0x772a9d85 in RtlExitUserProcess
(C:\Windows\SYSTEM32\ntdll.dll+0x4b2a9d85)
    #5 0x7702adc2 in ExitProcessImplementation
(C:\Windows\System32\KERNEL32.DLL+0x6b82adc2)
    #6 0x746796a4 in exit_or_terminate_process
(C:\Windows\System32\ucrtbase.dll+0x100396a4)
    #7 0x74679664 in common_exit (C:\Windows\System32\ucrtbase.dll+0x10039664)
    #8 0x74679600 in exit (C:\Windows\System32\ucrtbase.dll+0x10039600)
    #9 0xb01267 in _scrt_common_main_seh
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:260
    #10 0x770162c3 in BaseThreadInitThunk
(C:\Windows\System32\KERNEL32.DLL+0x6b8162c3)
    #11 0x772e0718 in __RtlUserThreadStart
(C:\Windows\SYSTEM32\ntdll.dll+0x4b2e0718)
    #12 0x772e06e3 in _RtlUserThreadStart
(C:\Windows\SYSTEM32\ntdll.dll+0x4b2e06e3)

Address 0x00bdaef0 is a wild pointer.
SUMMARY: AddressSanitizer: bad-free
d:\src\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cc:77 in free
==9112==ABORTING

That memory was allocated here, before the ASan runtime had an opportunity to
set up interceptions:

ntdll!RtlAllocateHeap+0x32
ucrtbase!_calloc_base+0x37
ucrtbase!__acrt_initialize_ptd+0x5a
ucrtbase!__acrt_execute_initializers+0x5c
ucrtbase!DllMainProcessAttach+0x18
ucrtbase!DllMainDispatch+0x28b
ucrtbase!__acrt_DllMain+0x14
ntdll!LdrxCallInitRoutine+0x16
ntdll!LdrpCallInitRoutine+0x43
ntdll!LdrpInitializeNode+0x10e
ntdll!LdrpInitializeGraphRecurse+0x5d
ntdll!LdrpInitializeGraphRecurse+0x74
ntdll!LdrpInitializeGraphRecurse+0x74
ntdll!LdrpInitializeGraphRecurse+0x74
ntdll!LdrpInitializeProcess+0xc22
ntdll!_LdrpInitialize+0x178
ntdll!LdrInitializeThunk+0x10

I suspect that the only way to deal with these is to have free() ignore
anything that belongs to the system heap.</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>