-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LoongArch][sanitizer] Fix SC_ADDRERR_{RD,WR} missing in the musl environment #108557
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
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
@llvm/pr-subscribers-compiler-rt-sanitizer Author: hev (heiher) ChangesFixes #108550 Full diff: https://github.com/llvm/llvm-project/pull/108557.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 16d06c69a38f32..f4a2f46c6ea022 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -2018,6 +2018,18 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
return Unknown;
return esr & ESR_ELx_WNR ? Write : Read;
# elif defined(__loongarch__)
+ // In the musl environment, the Linux kernel uapi sigcontext.h is not
+ // included in signal.h. To avoid missing the SC_ADDRERR_{RD,WR} macros,
+ // copy them here. The LoongArch Linux kernel uapi is already stable,
+ // so there's no need to worry about the value changing.
+# ifndef SC_ADDRERR_RD
+ // Address error was due to memory load
+# define SC_ADDRERR_RD (1 << 30)
+# endif
+# ifndef SC_ADDRERR_WR
+ // Address error was due to memory store
+# define SC_ADDRERR_WR (1 << 31)
+# endif
u32 flags = ucontext->uc_mcontext.__flags;
if (flags & SC_ADDRERR_RD)
return SignalContext::Read;
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
SixWeining
approved these changes
Sep 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/cherry-pick 1825cf2 |
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Sep 18, 2024
…ironment (llvm#108557) Fixes llvm#108550 (cherry picked from commit 1825cf2)
/pull-request #109110 |
tru
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Sep 24, 2024
…ironment (llvm#108557) Fixes llvm#108550 (cherry picked from commit 1825cf2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #108550