[libc-commits] [libc] [libc][bug] Fix out of bound write in memcpy w/ software prefetching (PR #90613)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue May 14 02:14:30 PDT 2024


================
@@ -140,6 +146,12 @@ inline_memcpy_x86_avx_ge64_sw_prefetching(Ptr __restrict dst,
     offset += K_THREE_CACHELINES;
   }
   return builtin::Memcpy<64>::loop_and_tail_offset(dst, src, count, offset);
+  // We don't use 'loop_and_tail_offset' because it assumes at least one
----------------
gchatelet wrote:

The code is obvioulsy wrong here. It's actually not fixing the out-of-bound write with software prefetchers for AVX. This code path is not tested because it depends on the `LIBC_COPT_MEMCPY_X86_USE_SOFTWARE_PREFETCHING` flag that is not activated for tests. We should be testing it but it depends on host runner hardware capabilities and so requires some more scaffolding.

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


More information about the libc-commits mailing list