[PATCH] D27052: [compiler-rt][asan] Fix overlaping parameters for memmove/memcpy on windows.

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 11:21:32 PST 2016


filcab added inline comments.


================
Comment at: lib/asan/asan_interceptors.cc:427
+  ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
+#endif
+}
----------------
I have a problem with this. It seems like it's hiding problems.

If the runtime called `__asan_memcpy`, it is because we actually had a call to `memcpy`, so we should check for overlap properly. This code is turning that off.
If `memcpy` and `memmove` are defined to the same, we shouldn't be erroring when `memmove` is called, though. But I don't see how calls to `__asan_memcpy`/`__asan_memmove` get converted to be the same function, since that's an ASan function, not the libc one.


================
Comment at: lib/asan/asan_interceptors.cc:460
   ASAN_INTERCEPTOR_ENTER(ctx, memcpy);
-#if !SANITIZER_MAC
+#if !SANITIZER_MAC && PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE
   ASAN_MEMCPY_IMPL(ctx, to, from, size);
----------------
This part looks ok, of course.


https://reviews.llvm.org/D27052





More information about the llvm-commits mailing list