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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 17:50:59 PST 2016


rnk added inline comments.


================
Comment at: lib/asan/asan_interceptors.cc:427
+  ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
+#endif
+}
----------------
filcab wrote:
> rnk wrote:
> > filcab wrote:
> > > 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.
> > In practice, we found, as Apple did, that on platforms where memcpy aliases memmove, it is not feasible to intercept them separately. If you trace through the existing logic, you'll see that we're already suppressing this error in the same way on Mac.
> But only for the interceptors. __asan_memcpy should only be called if instrumentMemIntrinsic added it, in AddressSanitizer.cpp. I don't think macOS is doing anything special there (if it were, this patch wouldn't even have the section where I posted the comment, as ASan would be handling it already)
Oh, right. Let's not change __asan_memcpy, then.


https://reviews.llvm.org/D27052





More information about the llvm-commits mailing list