[compiler-rt] [Sanitizer] Call Die() instead of Abort() when failed to reserve shadow memory range (PR #107833)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 02:56:15 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Enna1 (Enna1)

<details>
<summary>Changes</summary>

I grep the code and find that `Abort()` is only called in `Die()` when the flag `abort_on_error` is set.
Thus, if reserving shadow memory range fails, `Die()` rather than `Abort()` should be called. In this case, the flag `abort_on_error` will be respected and the die callbacks will be called.

---
Full diff: https://github.com/llvm/llvm-project/pull/107833.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index 3966d82d51ee96..684720963a8dcb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -171,7 +171,7 @@ void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name,
         "ReserveShadowMemoryRange failed while trying to map 0x%zx bytes. "
         "Perhaps you're using ulimit -v or ulimit -d\n",
         size);
-    Abort();
+    Die();
   }
   if (madvise_shadow && common_flags()->use_madv_dontdump)
     DontDumpShadowMemory(beg, size);

``````````

</details>


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


More information about the llvm-commits mailing list