[llvm] b867f5c - [Support/BLAKE3] Do manual instrumentation of `llvm_blake3_hasher_finalize` for memory sanitizer

Argyrios Kyrtzidis via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 09:59:35 PDT 2022


Author: Argyrios Kyrtzidis
Date: 2022-03-25T09:59:27-07:00
New Revision: b867f5c7b827304ddde057bfc0057e17efe4fe91

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

LOG: [Support/BLAKE3] Do manual instrumentation of `llvm_blake3_hasher_finalize` for memory sanitizer

This is to avoid false positives when using the uninstrumented assembly code implementation.

Added: 
    

Modified: 
    llvm/lib/Support/BLAKE3/blake3.c

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/BLAKE3/blake3.c b/llvm/lib/Support/BLAKE3/blake3.c
index d66771b90f5f9..a369452a3e759 100644
--- a/llvm/lib/Support/BLAKE3/blake3.c
+++ b/llvm/lib/Support/BLAKE3/blake3.c
@@ -571,6 +571,10 @@ void llvm_blake3_hasher_update(blake3_hasher *self, const void *input,
 void llvm_blake3_hasher_finalize(const blake3_hasher *self, uint8_t *out,
                             size_t out_len) {
   llvm_blake3_hasher_finalize_seek(self, 0, out, out_len);
+#if LLVM_MEMORY_SANITIZER_BUILD
+  // Avoid false positives due to uninstrumented assembly code.
+  __msan_unpoison(out, out_len);
+#endif
 }
 
 void llvm_blake3_hasher_finalize_seek(const blake3_hasher *self, uint64_t seek,


        


More information about the llvm-commits mailing list