Skip to content

Commit d8c3492

Browse files
committed
make: Disable branch-protection for PIE code on ARM64
Branch protection uses PAC. It cryptographically "signs" a function's return address before it is stored on the stack. Upon return, the address is authenticated using a secret key. If the signature is invalid, the program will fault. The PIE code is used for the parasite and the restorer. In both cases, it runs in a foreign process. The case of the restorer is even trickier because it needs to restore the original PAC keys, which invalidates all previously "signed" pointers within the restorer itself. Fixes #2709 Signed-off-by: Andrei Vagin <[email protected]>
1 parent 17a5c6e commit d8c3492

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ endif
6464

6565
ifeq ($(ARCH),aarch64)
6666
DEFINES := -DCONFIG_AARCH64
67+
CC_MBRANCH_PROT := $(shell $(CC) -c -x c /dev/null -mbranch-protection=none -o /dev/null >/dev/null 2>&1 && echo "-mbranch-protection=none")
68+
CFLAGS_PIE := $(CC_MBRANCH_PROT)
6769
endif
6870

6971
ifeq ($(ARCH),ppc64)

0 commit comments

Comments
 (0)