Skip to content

Commit 2015508

Browse files
[AArch64][compiler-rt] Add Pointer Authentication support for VFORK.
The LR is stored to off-stack spill area where it is vulnerable. "paciasp" add an auth code to the LR while the "autiasp" verifies that so LR can't be modiifed on the spill area. Test: build with -DCMAKE_C_FLAGS="-mbranch-protection=standard", run on Armv8.3 capable hardware with PAuth. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D98009
1 parent 023b5c1 commit 2015508

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#if defined(__aarch64__) && defined(__linux__)
22

33
#include "sanitizer_common/sanitizer_asm.h"
4+
#include "builtins/assembly.h"
45

56
ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)
67

@@ -9,6 +10,7 @@ ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)
910
ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
1011
ASM_WRAPPER_NAME(vfork):
1112
// Save x30 in the off-stack spill area.
13+
paciasp
1214
stp xzr, x30, [sp, #-16]!
1315
bl COMMON_INTERCEPTOR_SPILL_AREA
1416
ldp xzr, x30, [sp], 16
@@ -33,11 +35,14 @@ ASM_WRAPPER_NAME(vfork):
3335
bl COMMON_INTERCEPTOR_SPILL_AREA
3436
ldr x30, [x0]
3537
ldp x0, xzr, [sp], 16
38+
autiasp
3639

3740
ret
3841
ASM_SIZE(vfork)
3942

4043
.weak vfork
4144
.set vfork, ASM_WRAPPER_NAME(vfork)
4245

46+
GNU_PROPERTY_BTI_PAC
47+
4348
#endif

0 commit comments

Comments
 (0)