[compiler-rt] [scudo] Add hooks to mark the range of realloc (PR #74353)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 13:26:18 PST 2023


================
@@ -20,6 +20,20 @@ __attribute__((weak)) const char *__scudo_default_options(void);
 __attribute__((weak)) void __scudo_allocate_hook(void *ptr, size_t size);
 __attribute__((weak)) void __scudo_deallocate_hook(void *ptr);
 
+// `realloc` involves both deallocation and allocation but they are not reported
+// atomically. In one specific case which may keep taking a snapshot right in
+// the middle of `realloc` reporting the deallocation and allocation, it may
+// confuse the user by the missing memory from `realloc`. To alleviate that
+// case, define the two `realloc` hooks to get the knowledge of the bundled hook
+// calls. This hooks are optional and only used when you are pretty likely to
+// hit that specific case. Otherwise, the two general hooks above are pretty
----------------
ChiaHungDuan wrote:

Done

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


More information about the llvm-commits mailing list