[compiler-rt] Reland: [ASan][Windows] Fix memmove/memcpy interception on x64 (#192060) (PR #193633)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 25 09:14:27 PDT 2026


================
@@ -807,7 +815,27 @@ struct Allocator {
       uptr memcpy_size = Min(new_size, m->UsedSize());
       // If realloc() races with free(), we may start copying freed memory.
       // However, we will report racy double-free later anyway.
+#if SANITIZER_WINDOWS64
+      // On Win64, REAL(memcpy) only points at a distinct non-interceptor
+      // function when memcpy and memmove are separate CRT entry points. When
+      // they are aliased we keep REAL(memcpy) == REAL(memmove), and both may
+      // dispatch back through the intercepted libc routine, which performs
+      // shadow-checked reads. That is a problem for chunks upgraded from
+      // malloc(0) / HeapReAlloc(..., 0): the single live byte is still
----------------
vitalybuka wrote:

We need to extract this into platform specific function.
As is it does not help readability in allocators.

https://github.com/llvm/llvm-project/pull/193633


More information about the llvm-commits mailing list