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: unassignedb...@nondot.org
          Reporter: dma...@mozilla.com
                CC: llvm-bugs@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@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to