diff options
| author | Thurston Dang <thurston.dang@gmail.com> | 2025-08-30 00:03:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-30 00:03:56 -0700 |
| commit | 1e406814dd21aad7da6bd1c1a8e0c6f1c1cd5369 (patch) | |
| tree | 89a79e0de43f5205a52f09d667abbb7982819c4a | |
| parent | e68d66a1afea79d19f8b3f9b8bea6b4ff38685b7 (diff) | |
Revert "[msan] Detect dereferencing zero-alloc as use-of-uninitialized-value …"revert-155944-msan_zero_alloc
This reverts commit 8784dcef3485a3862e5cacc9e18c646d0225483b.
| -rw-r--r-- | compiler-rt/lib/msan/msan_allocator.cpp | 6 | ||||
| -rw-r--r-- | compiler-rt/test/msan/zero_alloc.cpp | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp index 64df863839c0..2b543db49d36 100644 --- a/compiler-rt/lib/msan/msan_allocator.cpp +++ b/compiler-rt/lib/msan/msan_allocator.cpp @@ -230,12 +230,6 @@ static void *MsanAllocate(BufferedStackTrace *stack, uptr size, uptr alignment, __msan_set_origin(allocated, size, o.raw_id()); } } - - uptr actually_allocated_size = allocator.GetActuallyAllocatedSize(allocated); - // For compatibility, the allocator converted 0-sized allocations into 1 byte - if (size == 0 && actually_allocated_size > 0 && flags()->poison_in_malloc) - __msan_poison(allocated, 1); - UnpoisonParam(2); RunMallocHooks(allocated, size); return allocated; diff --git a/compiler-rt/test/msan/zero_alloc.cpp b/compiler-rt/test/msan/zero_alloc.cpp index 6e38ce4c0a8f..e60051872eba 100644 --- a/compiler-rt/test/msan/zero_alloc.cpp +++ b/compiler-rt/test/msan/zero_alloc.cpp @@ -1,5 +1,9 @@ // RUN: %clang_msan -Wno-alloc-size -fsanitize-recover=memory %s -o %t && not %run %t 2>&1 | FileCheck %s +// MSan doesn't catch this because internally it translates 0-byte allocations +// into 1-byte +// XFAIL: * + #include <malloc.h> #include <stdio.h> |
