[cfe-dev] Using the AddressSanitizer under Windows

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 24 14:26:21 PST 2019

The first error message indicates that the ASan runtime failed to intercept
memcpy. The code in question looks like this:

#define INIT_MEMCPY                                  \
  do {                                               \
      COMMON_INTERCEPT_FUNCTION(memcpy);             \
    } else {                                         \
      ASSIGN_REAL(memcpy, memmove);                  \
    }                                                \
    CHECK(REAL(memcpy));                             \
  } while (false)

If you run with ASAN_OPTIONS=verbosity=3 you will get more information
about interception failures. ASan on Windows uses various hotpatching
techniques to intercept and override the default application memcpy, but
they often fail on different versions of Windows DLLs with novel code
patterns in the prologue. It is very fragile and I would love for it to be
replaced with something more robust.

The follow-on CHECK failure is probably not important.

If you're interested, I'd recommend putting together a bug report. It's
worth including the versions of Windows and the Visual C++ runtime that you
are using. Either the https://bugs.llvm.org or
https://github.com/google/sanitizers/ are reasonable places for it.

On Wed, Jan 23, 2019 at 11:13 PM Gaier, Bjoern via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello everyone,
> I heard a lot of good things about clangs "Sanitizer" so I wanted to test
> the "AddressSanitizer" with clang-cl. I complied LLVM7, Clang and
> Compiler-rt on my machine, wrote a simple test application and passed
> "-Xclang -fsanitize=address" to clang-cl. The linker then complained about
> undefined references. Because I'm on a Windows7 x64 machine I then linked
> "clang_rt.asan-x86_64.lib" to my project.
> When I now execute my test application I get the messages:
> ==8160==AddressSanitizer CHECK failed:
> \compiler-rt-7.0.0.src\lib\sanitizer_common\sanitizer_common_interceptors.inc:7265
> "((__interception::real_memcpy)) != (0)" (0x0, 0x0)
> ==8004==AddressSanitizer CHECK failed:
> \compiler-rt-7.0.0.src\lib\asan\asan_poisoning.cc:37 "((AddrIsInMem(addr)))
> != (0)" (0x0, 0x0)
> What am I doing wrong?
> Kind greetings
> Björn
> Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816,
> USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert
> Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima.
> Junichi Tajika
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190124/4e4145f0/attachment.html>

More information about the cfe-dev mailing list