-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[tsan][aarch64] Fix branch protection in interceptors #95839
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
Conversation
Start functions with BTI in order to identify the function as a valid branch target. Also add the BTI marker to tsan_rtl_aarch64.S. With this patch, libclang_rt.tsan.so can now be generated with DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Tulio Magno Quites Machado Filho (tuliom) ChangesStart functions with BTI in order to identify the function as a valid branch target. With this patch, libclang_rt.tsan.so can now be generated with DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard. Full diff: https://github.com/llvm/llvm-project/pull/95839.diff 1 Files Affected:
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S b/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
index c6162659b8766..7d920bee4a2db 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
@@ -2,6 +2,7 @@
#if defined(__aarch64__)
#include "sanitizer_common/sanitizer_asm.h"
+#include "builtins/assembly.h"
#if !defined(__APPLE__)
.section .text
@@ -16,6 +17,7 @@ ASM_HIDDEN(__tsan_setjmp)
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
ASM_SYMBOL_INTERCEPTOR(setjmp):
CFI_STARTPROC
+ BTI_C
// Save frame/link register
stp x29, x30, [sp, -32]!
@@ -66,6 +68,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
ASM_SYMBOL_INTERCEPTOR(_setjmp):
CFI_STARTPROC
+ BTI_C
// Save frame/link register
stp x29, x30, [sp, -32]!
@@ -116,6 +119,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
CFI_STARTPROC
+ BTI_C
// Save frame/link register
stp x29, x30, [sp, -32]!
@@ -168,6 +172,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
CFI_STARTPROC
+ BTI_C
// Save frame/link register
stp x29, x30, [sp, -32]!
@@ -217,4 +222,6 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
NO_EXEC_STACK_DIRECTIVE
+GNU_PROPERTY_BTI_PAC
+
#endif
|
The macro use matches other |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/964 Here is the relevant piece of the build log for the reference:
|
Start functions with BTI in order to identify the function as a valid branch target. Also add the BTI marker to tsan_rtl_aarch64.S. With this patch, libclang_rt.tsan.so can now be generated with DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard.
Start functions with BTI in order to identify the function as a valid branch target. Also add the BTI marker to tsan_rtl_aarch64.S. With this patch, libclang_rt.tsan.so can now be generated with DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard.
Start functions with BTI in order to identify the function as a valid branch target.
Also add the BTI marker to tsan_rtl_aarch64.S.
With this patch, libclang_rt.tsan.so can now be generated with DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard.