<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 2:29 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">It seems that the culprit is llvm/unittests/MC/<wbr>DwarfLineTables.cpp, which has a global variable “Context” that initializes all of LLVM (InitializeAllTargetInfos(), <wbr>InitializeAllTargetMCs(), <wbr>InitializeAllDisassemblers(), etc.).<div><br></div><div>It seems to have been there forever, but just got uncovered by “luck” (or lack of thereof) by ASAN.</div><div><br></div><div>Fixed in r286647 hopefully.</div></div></blockquote><div><br></div><div>yep!</div><div><br></div><div>thanks! </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><div><br></div><div><div><blockquote type="cite"><div>On Nov 11, 2016, at 1:44 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>> wrote:</div><br class="m_-1601893055016594299Apple-interchange-newline"><div><div dir="ltr">Mehdi, Teresa, <div><br></div><div>Not sure if this is caused by one of your recent commits, or by someone else's,</div><div>please excuse me if that's unrelated to your work... </div><div><br></div><div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/542/steps/check-llvm%20asan/logs/stdio" target="_blank">http://lab.llvm.org:8011/<wbr>builders/sanitizer-x86_64-<wbr>linux-fast/builds/542/steps/<wbr>check-llvm%20asan/logs/stdio</a><br></div><div><br></div><div><pre style="font-family:'courier new',courier,monotype,monospace;font-size:inherit"><span class="m_-1601893055016594299gmail-stdout">==26383==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x000002ef41d8 at pc 0x0000009d1aa5 bp 0x7ffd0cd72b50 sp 0x7ffd0cd72b48
READ of size 4 at 0x000002ef41d8 thread T0
    #0 0x9d1aa4 in getValue /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/include/llvm/<wbr>Support/CommandLine.h:1229:38
    #1 0x9d1aa4 in operator AsmWriterFlavorTy /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/include/llvm/<wbr>Support/CommandLine.h:1233
    #2 0x9d1aa4 in llvm::X86ELFMCAsmInfo::<wbr>X86ELFMCAsmInfo(llvm::Triple const&) /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/lib/Target/X86/<wbr>MCTargetDesc/X86MCAsmInfo.cpp:<wbr>100
    #3 0x9cf3e1 in createX86MCAsmInfo(llvm::<wbr>MCRegisterInfo const&, llvm::Triple const&) /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/lib/Target/X86/<wbr>MCTargetDesc/X86MCTargetDesc.<wbr>cpp:179:15
    #4 0x421020 in createMCAsmInfo /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/include/llvm/<wbr>Support/TargetRegistry.h:298:<wbr>12
    #5 0x421020 in Context /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/unittests/MC/<wbr>DwarfLineTables.cpp:41
    #6 0x421020 in __cxx_global_var_init /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/unittests/MC/<wbr>DwarfLineTables.cpp:49
    #7 0x421020 in _GLOBAL__sub_I_<wbr>DwarfLineTables.cpp /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/unittests/MC/<wbr>DwarfLineTables.cpp
    #8 0x102efcc in __libc_csu_init (/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_asan/<wbr>unittests/MC/MCTests+<wbr>0x102efcc)
    #9 0x7f57fa3d8ed4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.<wbr>so.6+0x21ed4)
    #10 0x4b4222 in _start (/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_asan/<wbr>unittests/MC/MCTests+0x4b4222)

0x000002ef41d8 is located 152 bytes inside of global variable 'AsmWriterFlavor' defined in '/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/lib/Target/X86/<wbr>MCTargetDesc/X86MCAsmInfo.cpp:<wbr>31:1' (0x2ef4140) of size 600
  registered at:
    #0 0x4c63fd in __asan_register_globals.part.<wbr>15 /mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm/projects/compiler-<wbr>rt/lib/asan/asan_globals.cc:<wbr>338
    #1 0x9d3f9b in asan.module_ctor (/mnt/b/sanitizer-buildbot3/<wbr>sanitizer-x86_64-linux-fast/<wbr>build/llvm_build_asan/<wbr>unittests/MC/MCTests+0x9d3f9b)</span></pre><pre style="font-family:'courier new',courier,monotype,monospace;font-size:inherit"><span class="m_-1601893055016594299gmail-stdout"><br></span></pre>The reports seems correct. </div>The flag object AsmWriterFlavor is used before it is initialized in initialization of some other global object. <div><br></div><div>This makes the asan bot red... :( </div><div><br></div><div>Thanks, </div><div>--kcc</div></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div>