[compiler-rt][aarch64] Add PAC-RET/BTI support to HWASAN.
Support for -mbranch-protection. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D100143
This commit is contained in:
parent
63bc9e4435
commit
a46effbd2a
@ -105,9 +105,11 @@
|
||||
.popsection
|
||||
|
||||
#if BTI_FLAG != 0
|
||||
#define BTI_C bti c
|
||||
#define BTI_C hint #34
|
||||
#define BTI_J hint #36
|
||||
#else
|
||||
#define BTI_C
|
||||
#define BTI_J
|
||||
#endif
|
||||
|
||||
#if (BTI_FLAG | PAC_FLAG) != 0
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "sanitizer_common/sanitizer_asm.h"
|
||||
#include "builtins/assembly.h"
|
||||
|
||||
#if HWASAN_WITH_INTERCEPTORS && defined(__aarch64__)
|
||||
#include "sanitizer_common/sanitizer_platform.h"
|
||||
@ -34,6 +35,7 @@
|
||||
ASM_TYPE_FUNCTION(__interceptor_setjmp)
|
||||
__interceptor_setjmp:
|
||||
CFI_STARTPROC
|
||||
BTI_C
|
||||
mov x1, #0
|
||||
b __interceptor_sigsetjmp
|
||||
CFI_ENDPROC
|
||||
@ -46,6 +48,7 @@ ASM_SIZE(__interceptor_setjmp)
|
||||
ASM_TYPE_FUNCTION(__interceptor_setjmp_bionic)
|
||||
__interceptor_setjmp_bionic:
|
||||
CFI_STARTPROC
|
||||
BTI_C
|
||||
mov x1, #1
|
||||
b __interceptor_sigsetjmp
|
||||
CFI_ENDPROC
|
||||
@ -56,6 +59,7 @@ ASM_SIZE(__interceptor_setjmp_bionic)
|
||||
ASM_TYPE_FUNCTION(__interceptor_sigsetjmp)
|
||||
__interceptor_sigsetjmp:
|
||||
CFI_STARTPROC
|
||||
BTI_C
|
||||
stp x19, x20, [x0, #0<<3]
|
||||
stp x21, x22, [x0, #2<<3]
|
||||
stp x23, x24, [x0, #4<<3]
|
||||
@ -98,3 +102,5 @@ ALIAS __interceptor_setjmp, _setjmp
|
||||
|
||||
// We do not need executable stack.
|
||||
NO_EXEC_STACK_DIRECTIVE
|
||||
|
||||
GNU_PROPERTY_BTI_PAC
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "sanitizer_common/sanitizer_asm.h"
|
||||
#include "builtins/assembly.h"
|
||||
|
||||
// The content of this file is AArch64-only:
|
||||
#if defined(__aarch64__)
|
||||
@ -74,6 +75,8 @@
|
||||
.global __hwasan_tag_mismatch
|
||||
.type __hwasan_tag_mismatch, %function
|
||||
__hwasan_tag_mismatch:
|
||||
BTI_J
|
||||
|
||||
// Compute the granule position one past the end of the access.
|
||||
mov x16, #1
|
||||
and x17, x1, #0xf
|
||||
@ -106,6 +109,7 @@ __hwasan_tag_mismatch:
|
||||
.type __hwasan_tag_mismatch_v2, %function
|
||||
__hwasan_tag_mismatch_v2:
|
||||
CFI_STARTPROC
|
||||
BTI_J
|
||||
|
||||
// Set the CFA to be the return address for caller of __hwasan_check_*. Note
|
||||
// that we do not emit CFI predicates to describe the contents of this stack
|
||||
@ -150,3 +154,5 @@ __hwasan_tag_mismatch_v2:
|
||||
|
||||
// We do not need executable stack.
|
||||
NO_EXEC_STACK_DIRECTIVE
|
||||
|
||||
GNU_PROPERTY_BTI_PAC
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user