[compiler-rt] [ASan] [HWASan] Add __sanitizer_ignore_free_hook() (PR #96749)

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 01:30:37 PDT 2024


================
@@ -289,6 +289,9 @@ static void HwasanDeallocate(StackTrace *stack, void *tagged_ptr) {
   CHECK(tagged_ptr);
   void *untagged_ptr = UntagPtr(tagged_ptr);
 
+  if (RunFreeHooks(tagged_ptr))
----------------
hctim wrote:

A concrete use case: The program is doing a free without the correct tag, and you want to silence the invalid-free check. In your runtime library, you can declare the hook, ignore the free(), then grab the tag and put it in the pointer, then call free again.

I figure it's more feature-rich for no downsides :).

https://github.com/llvm/llvm-project/pull/96749


More information about the llvm-commits mailing list