[libc-commits] [libc] 219a1d2 - [libc] Fix running benchmarks under msan/asan

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Sep 8 07:54:29 PDT 2021


Author: Guillaume Chatelet
Date: 2021-09-08T14:43:55Z
New Revision: 219a1d217dd95f98612f7ac5d8f25b737c7f5e8b

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

LOG: [libc] Fix running benchmarks under msan/asan

asan/msan intercepts `aligned_malloc` and misbehave when the requested
alignment is greater than 512.
https://github.com/llvm/llvm-project/blob/b041b613e6fff713fc9ad6dbc73024286fb2fc93/compiler-rt/lib/asan/asan_allocator.cpp#L430-L431

Added: 
    

Modified: 
    libc/benchmarks/LibcMemoryBenchmark.h

Removed: 
    


################################################################################
diff  --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h
index b6ee47c1f62de..7badf046a25c3 100644
--- a/libc/benchmarks/LibcMemoryBenchmark.h
+++ b/libc/benchmarks/LibcMemoryBenchmark.h
@@ -105,7 +105,8 @@ class AlignedBuffer {
   size_t Size = 0;
 
 public:
-  static constexpr size_t Alignment = 1024;
+  // Note: msan / asan can't handle Alignment > 512.
+  static constexpr size_t Alignment = 512;
 
   explicit AlignedBuffer(size_t Size)
       : Buffer(static_cast<char *>(aligned_alloc(Alignment, Size))),


        


More information about the libc-commits mailing list