https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112794
>From 7e8937dd9c1a5895be178de0d7721cc3ed23b395 Mon Sep 17 00:00:00 2001 From: Vitaly Buka <vitalyb...@google.com> Date: Thu, 17 Oct 2024 16:49:32 -0700 Subject: [PATCH 1/3] fixes Created using spr 1.3.4 --- .../lib/sanitizer_common/sanitizer_common.h | 2 +- .../sanitizer_common/sanitizer_common_libcdep.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index a7b6a4033a5276..dd55f91dd95d06 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -273,7 +273,7 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size); // Returns true if we can read a memory range starting at `src`, and copies // content into `dest`. bool TryMemCpy(void *dest, const void *src, uptr n); -// Copies accesible memory, and zero fill the rest. +// Copies accessible memory, and zero fill the rest. void MemCpyAccessible(void *dest, const void *src, uptr n); // Error report formatting. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp index 3ad5aaa0a7d4ab..a2b10001843a42 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp @@ -230,18 +230,18 @@ void MemCpyAccessible(void *dest, const void *src, uptr n) { uptr e = reinterpret_cast<uptr>(src) + n; uptr e_down = RoundDownTo(e, page_size); - auto copy_or_zero = [dest, src](uptr b, uptr e) { - uptr d = reinterpret_cast<uptr>(dest) + (b - reinterpret_cast<uptr>(src)); - if (!TryMemCpy(reinterpret_cast<void *>(d), reinterpret_cast<void *>(b), - e - b)) - internal_memset(reinterpret_cast<void *>(d), 0, e - b); + const uptr off = reinterpret_cast<uptr>(dest) - b; + + auto copy_or_zero = [off](uptr beg, uptr end) { + void *d = reinterpret_cast<void *>(beg + off); + const uptr size = end - beg; + if (!TryMemCpy(d, reinterpret_cast<void *>(beg), size)) + internal_memset(d, 0, size); }; copy_or_zero(b, b_up); - for (uptr p = b_up; p < e_down; p += page_size) copy_or_zero(p, p + page_size); - copy_or_zero(e_down, e); } >From d920ef34ac86e51a5e16785fab9311dfa202a58b Mon Sep 17 00:00:00 2001 From: Vitaly Buka <vitalyb...@google.com> Date: Thu, 17 Oct 2024 17:08:13 -0700 Subject: [PATCH 2/3] offset Created using spr 1.3.4 --- .../lib/sanitizer_common/sanitizer_common_libcdep.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp index a2b10001843a42..838881be3a0a0c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp @@ -230,10 +230,10 @@ void MemCpyAccessible(void *dest, const void *src, uptr n) { uptr e = reinterpret_cast<uptr>(src) + n; uptr e_down = RoundDownTo(e, page_size); - const uptr off = reinterpret_cast<uptr>(dest) - b; - - auto copy_or_zero = [off](uptr beg, uptr end) { - void *d = reinterpret_cast<void *>(beg + off); + auto copy_or_zero = [dest, src](uptr beg, uptr end) { + const uptr udest = reinterpret_cast<uptr>(dest); + const uptr usrc = reinterpret_cast<uptr>(src); + void *d = reinterpret_cast<void *>(udest + beg - usrc); const uptr size = end - beg; if (!TryMemCpy(d, reinterpret_cast<void *>(beg), size)) internal_memset(d, 0, size); >From a1784456bebf5c3a4784b582e121f4a5d1495147 Mon Sep 17 00:00:00 2001 From: Vitaly Buka <vitalyb...@google.com> Date: Thu, 17 Oct 2024 17:09:23 -0700 Subject: [PATCH 3/3] optional () Created using spr 1.3.4 --- compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp index 838881be3a0a0c..f275e81ff04169 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp @@ -233,7 +233,7 @@ void MemCpyAccessible(void *dest, const void *src, uptr n) { auto copy_or_zero = [dest, src](uptr beg, uptr end) { const uptr udest = reinterpret_cast<uptr>(dest); const uptr usrc = reinterpret_cast<uptr>(src); - void *d = reinterpret_cast<void *>(udest + beg - usrc); + void *d = reinterpret_cast<void *>(udest + (beg - usrc)); const uptr size = end - beg; if (!TryMemCpy(d, reinterpret_cast<void *>(beg), size)) internal_memset(d, 0, size); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits