[compiler-rt] ca0fab0 - [hwasan] Suppress leaks from dlsym with hwasan+lsan just like with
Leonard Chan via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 13:42:48 PST 2023
Author: Leonard Chan
Date: 2023-03-09T21:42:04Z
New Revision: ca0fab0c36b73f3ec8339cc5849dda9143d4537e
URL: https://github.com/llvm/llvm-project/commit/ca0fab0c36b73f3ec8339cc5849dda9143d4537e
DIFF: https://github.com/llvm/llvm-project/commit/ca0fab0c36b73f3ec8339cc5849dda9143d4537e.diff
LOG: [hwasan] Suppress leaks from dlsym with hwasan+lsan just like with
asan+lsan
We should follow suite with how asan handles this now that lsan also
works with hwasan.
Differential Revision: https://reviews.llvm.org/D145613
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
index 9cd82dbabd19b..ad359b12904b3 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
@@ -24,6 +24,18 @@ using namespace __hwasan;
struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {
static bool UseImpl() { return !hwasan_inited; }
+ static void OnAllocate(const void *ptr, uptr size) {
+# if CAN_SANITIZE_LEAKS
+ // Suppress leaks from dlerror(). Previously dlsym hack on global array was
+ // used by leak sanitizer as a root region.
+ __lsan_register_root_region(ptr, size);
+# endif
+ }
+ static void OnFree(const void *ptr, uptr size) {
+# if CAN_SANITIZE_LEAKS
+ __lsan_unregister_root_region(ptr, size);
+# endif
+ }
};
extern "C" {
More information about the llvm-commits
mailing list