<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_shadow_memory_dynamic_address is initialized too late relative to other code"
href="https://llvm.org/bugs/show_bug.cgi?id=30810">30810</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__asan_shadow_memory_dynamic_address is initialized too late relative to other code
</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>One of our DLLs contains this global:
bool mmx_enabled = has_cpuid_bits(1u, edx, (1u<<23));
which gets initialized here:
mozglue!`anonymous namespace'::has_cpuid_bits
mozglue!??__Emmx_enabled@sse_private@mozilla@@YAXXZ+0x1f
mozglue!_GLOBAL__sub_I_SSE.cpp+0x22
ucrtbase!_initterm+0x43
mozglue!dllmain_crt_process_attach+0xa7
mozglue!dllmain_crt_dispatch+0x3b
mozglue!dllmain_dispatch+0x59
mozglue!_DllMainCRTStartup+0x1c
ntdll!LdrxCallInitRoutine+0x16
But __asan_shadow_memory_dynamic_address isn't initialized until slightly
later:
mozglue!`dynamic initializer for '__asan_shadow_memory_dynamic_address''+0xb
ucrtbase!_initterm+0x43
mozglue!dllmain_crt_process_attach+0xa7
mozglue!dllmain_crt_dispatch+0x3b
mozglue!dllmain_dispatch+0x59
mozglue!_DllMainCRTStartup+0x1c
ntdll!LdrxCallInitRoutine+0x16
It happens to work on 32-bit builds where a shadow region of 0x30000000 is
hard-coded into has_cpuid_bits, but it crashes on 64-bit builds where
has_cpuid_bits needs to use the dynamic address.</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>