[llvm-bugs] [Bug 30810] New: __asan_shadow_memory_dynamic_address is initialized too late relative to other code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 27 09:40:48 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30810

            Bug ID: 30810
           Summary: __asan_shadow_memory_dynamic_address is initialized
                    too late relative to other code
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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 at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161027/d19be77d/attachment-0001.html>


More information about the llvm-bugs mailing list