[llvm-branch-commits] [compiler-rt] 0b99385 - [MSan] Partially revert some changes from D94552

Jianzhou Zhao via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 12 23:08:02 PST 2021


Author: Jianzhou Zhao
Date: 2021-01-13T07:03:17Z
New Revision: 0b99385e151c7cb674d6d29acfe92680f7148434

URL: https://github.com/llvm/llvm-project/commit/0b99385e151c7cb674d6d29acfe92680f7148434
DIFF: https://github.com/llvm/llvm-project/commit/0b99385e151c7cb674d6d29acfe92680f7148434.diff

LOG: [MSan] Partially revert some changes from D94552

Because of line 55, actually aligned_beg always equals to beg.

Added: 
    

Modified: 
    compiler-rt/lib/msan/msan_poisoning.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/msan/msan_poisoning.cpp b/compiler-rt/lib/msan/msan_poisoning.cpp
index 8f58432d528a..d121d45a1951 100644
--- a/compiler-rt/lib/msan/msan_poisoning.cpp
+++ b/compiler-rt/lib/msan/msan_poisoning.cpp
@@ -71,13 +71,12 @@ void CopyOrigin(const void *dst, const void *src, uptr size,
   if (beg < end) {
     // Align src up.
     uptr s = ((uptr)src + 3) & ~3UL;
-    uptr aligned_beg = ((uptr)dst + 3) & ~3UL;
     // FIXME: factor out to msan_copy_origin_aligned
     if (__msan_get_track_origins() > 1) {
       u32 *src = (u32 *)MEM_TO_ORIGIN(s);
       u32 *src_s = (u32 *)MEM_TO_SHADOW(s);
-      u32 *src_end = (u32 *)MEM_TO_ORIGIN(s + (end - aligned_beg));
-      u32 *dst = (u32 *)MEM_TO_ORIGIN(aligned_beg);
+      u32 *src_end = (u32 *)MEM_TO_ORIGIN(s + (end - beg));
+      u32 *dst = (u32 *)MEM_TO_ORIGIN(beg);
       u32 src_o = 0;
       u32 dst_o = 0;
       for (; src < src_end; ++src, ++src_s, ++dst) {
@@ -89,9 +88,8 @@ void CopyOrigin(const void *dst, const void *src, uptr size,
         *dst = dst_o;
       }
     } else {
-      REAL(memcpy)
-      ((void *)MEM_TO_ORIGIN(aligned_beg), (void *)MEM_TO_ORIGIN(s),
-       end - aligned_beg);
+      REAL(memcpy)((void *)MEM_TO_ORIGIN(beg), (void *)MEM_TO_ORIGIN(s),
+                   end - beg);
     }
   }
 }


        


More information about the llvm-branch-commits mailing list