[llvm-branch-commits] [sanitizer] Add MemCpyAccessible (PR #112794)
Florian Mayer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 17 16:32:35 PDT 2024
================
@@ -219,6 +219,32 @@ static void StopStackDepotBackgroundThread() {
static void StopStackDepotBackgroundThread() {}
#endif
+void MemCpyAccessible(void *dest, const void *src, uptr n) {
+ if (TryMemCpy(dest, src, n))
+ return;
+
+ const uptr page_size = GetPageSize();
+ uptr b = reinterpret_cast<uptr>(src);
+ uptr b_up = RoundUpTo(b, page_size);
+
+ uptr e = reinterpret_cast<uptr>(src) + n;
+ uptr e_down = RoundDownTo(e, page_size);
+
+ auto copy_or_zero = [dest, src](uptr b, uptr e) {
----------------
fmayer wrote:
Don't reuse `b` and `e` in and outside of the lambda
https://github.com/llvm/llvm-project/pull/112794
More information about the llvm-branch-commits
mailing list