[PATCH] D145613: [hwasan] Suppress leaks from dlsym with hwasan+lsan just like with asan+lsan
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 13:42:55 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGca0fab0c36b7: [hwasan] Suppress leaks from dlsym with hwasan+lsan just like with (authored by leonardchan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145613/new/
https://reviews.llvm.org/D145613
Files:
compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
Index: compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
===================================================================
--- compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
+++ compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp
@@ -24,6 +24,18 @@
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" {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145613.503924.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/673bb031/attachment.bin>
More information about the llvm-commits
mailing list