From 39c0602414d4b0efb1e4749b0e9fdd7974026bf7 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Wed, 5 Apr 2023 16:16:49 -0700 Subject: [PATCH] [lsan] Rename IgnoreObjectLocked into IgnoreObject We don't lock allocator for this call. --- compiler-rt/lib/asan/asan_allocator.cpp | 2 +- compiler-rt/lib/hwasan/hwasan_allocator.cpp | 5 ++--- compiler-rt/lib/lsan/lsan_allocator.cpp | 2 +- compiler-rt/lib/lsan/lsan_common.cpp | 2 +- compiler-rt/lib/lsan/lsan_common.h | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp index 708d975..2d6a5dd 100644 --- a/compiler-rt/lib/asan/asan_allocator.cpp +++ b/compiler-rt/lib/asan/asan_allocator.cpp @@ -1144,7 +1144,7 @@ void ForEachChunk(ForEachChunkCallback callback, void *arg) { __asan::get_allocator().ForEachChunk(callback, arg); } -IgnoreObjectResult IgnoreObjectLocked(const void *p) { +IgnoreObjectResult IgnoreObject(const void *p) { uptr addr = reinterpret_cast(p); __asan::AsanChunk *m = __asan::instance.GetAsanChunkByAddr(addr); if (!m || diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp index b3432f9..6760100 100644 --- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp +++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp @@ -618,11 +618,10 @@ void ForEachChunk(ForEachChunkCallback callback, void *arg) { __hwasan::allocator.ForEachChunk(callback, arg); } -IgnoreObjectResult IgnoreObjectLocked(const void *p) { +IgnoreObjectResult IgnoreObject(const void *p) { p = __hwasan::InTaggableRegion(reinterpret_cast(p)) ? UntagPtr(p) : p; uptr addr = reinterpret_cast(p); - uptr chunk = - reinterpret_cast(__hwasan::allocator.GetBlockBegin(p)); + uptr chunk = reinterpret_cast(__hwasan::allocator.GetBlockBegin(p)); if (!chunk) return kIgnoreObjectInvalid; __hwasan::Metadata *metadata = reinterpret_cast<__hwasan::Metadata *>( diff --git a/compiler-rt/lib/lsan/lsan_allocator.cpp b/compiler-rt/lib/lsan/lsan_allocator.cpp index 471b134a..8399427 100644 --- a/compiler-rt/lib/lsan/lsan_allocator.cpp +++ b/compiler-rt/lib/lsan/lsan_allocator.cpp @@ -324,7 +324,7 @@ void ForEachChunk(ForEachChunkCallback callback, void *arg) { allocator.ForEachChunk(callback, arg); } -IgnoreObjectResult IgnoreObjectLocked(const void *p) { +IgnoreObjectResult IgnoreObject(const void *p) { void *chunk = allocator.GetBlockBegin(p); if (!chunk || p < chunk) return kIgnoreObjectInvalid; ChunkMetadata *m = Metadata(chunk); diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index f9a456b..ae29e4a 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -997,7 +997,7 @@ void __lsan_ignore_object(const void *p) { // Cannot use PointsIntoChunk or LsanMetadata here, since the allocator is not // locked. Lock l(&global_mutex); - IgnoreObjectResult res = IgnoreObjectLocked(p); + IgnoreObjectResult res = IgnoreObject(p); if (res == kIgnoreObjectInvalid) VReport(1, "__lsan_ignore_object(): no heap object found at %p\n", p); if (res == kIgnoreObjectAlreadyIgnored) diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h index 0efdbf0..a1f2d1a 100644 --- a/compiler-rt/lib/lsan/lsan_common.h +++ b/compiler-rt/lib/lsan/lsan_common.h @@ -154,7 +154,7 @@ class LsanMetadata { void ForEachChunk(ForEachChunkCallback callback, void *arg); // Helper for __lsan_ignore_object(). -IgnoreObjectResult IgnoreObjectLocked(const void *p); +IgnoreObjectResult IgnoreObject(const void *p); // The rest of the LSan interface which is implemented by library. -- 2.7.4