-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[UBSan] [min-rt] make minimal runtime handlers weak #154220
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
Merged
fmayer
merged 1 commit into
main
from
users/fmayer/spr/ubsan-min-rt-make-minimal-runtime-handlers-weak
Aug 18, 2025
Merged
[UBSan] [min-rt] make minimal runtime handlers weak #154220
fmayer
merged 1 commit into
main
from
users/fmayer/spr/ubsan-min-rt-make-minimal-runtime-handlers-weak
Aug 18, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Created using spr 1.3.4
Member
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Florian Mayer (fmayer) ChangesThis allows people to override them, if they want. Full diff: https://github.com/llvm/llvm-project/pull/154220.diff 1 Files Affected:
diff --git a/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp b/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
index a2a2e36e8523d..1e143075f1bee 100644
--- a/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
+++ b/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
@@ -125,15 +125,13 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
} // namespace __sanitizer
#endif
-#define INTERFACE extern "C" __attribute__((visibility("default")))
-
#define HANDLER_RECOVER(name, kind) \
- INTERFACE void __ubsan_handle_##name##_minimal() { \
+ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal) { \
__ubsan_report_error(kind, GET_CALLER_PC(), nullptr); \
}
#define HANDLER_NORECOVER(name, kind) \
- INTERFACE void __ubsan_handle_##name##_minimal_abort() { \
+ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal_abort) { \
uintptr_t caller = GET_CALLER_PC(); \
__ubsan_report_error_fatal(kind, caller, nullptr); \
abort_with_message(kind, caller, nullptr); \
@@ -144,13 +142,14 @@ void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
HANDLER_NORECOVER(name, kind)
#define HANDLER_RECOVER_PTR(name, kind) \
- INTERFACE void __ubsan_handle_##name##_minimal(const uintptr_t address) { \
+ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal, \
+ const uintptr_t address) { \
__ubsan_report_error(kind, GET_CALLER_PC(), &address); \
}
#define HANDLER_NORECOVER_PTR(name, kind) \
- INTERFACE void __ubsan_handle_##name##_minimal_abort( \
- const uintptr_t address) { \
+ SANITIZER_INTERFACE_WEAK_DEF(void, __ubsan_handle_##name##_minimal_abort, \
+ const uintptr_t address) { \
uintptr_t caller = GET_CALLER_PC(); \
__ubsan_report_error_fatal(kind, caller, &address); \
abort_with_message(kind, caller, &address); \
|
thurstond
approved these changes
Aug 18, 2025
vitalybuka
added a commit
that referenced
this pull request
Sep 4, 2025
This reverts commit 1947467.
vitalybuka
added a commit
that referenced
this pull request
Sep 4, 2025
Existing `__ubsan_report_error` should be enough to solve this. Ability to override on two levels, may result in hard to debug bugs when in the same binary strong __ubsan_report_error and __ubsan_handle_##name##_minimal_abort defined in unrelated components. With one entry point we will have at least linking error. Reverts #154220
llvm-sync bot
pushed a commit
to arm/arm-toolchain
that referenced
this pull request
Sep 4, 2025
…k" (#156975) Existing `__ubsan_report_error` should be enough to solve this. Ability to override on two levels, may result in hard to debug bugs when in the same binary strong __ubsan_report_error and __ubsan_handle_##name##_minimal_abort defined in unrelated components. With one entry point we will have at least linking error. Reverts llvm/llvm-project#154220
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows people to override them, if they want.