Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

Enna1
Copy link
Contributor

@Enna1 Enna1 commented Sep 9, 2024

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.

…ow memory range

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.
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2024

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

Author: Enna1 (Enna1)

Changes

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 --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);

@Enna1 Enna1 merged commit a20794b into main Sep 17, 2024
10 checks passed
@Enna1 Enna1 deleted the users/Enna1/die-if-reserve-shadow-fail branch September 17, 2024 01:53
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
…ow memory range (llvm#107833)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants