From a5cb8a78429e190dbb9f0bdc57b7116950a270ec Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Fri, 11 Jul 2025 18:47:07 +0000 Subject: [PATCH] ANDROID: Disable BTI and enable UNWIND_PATCH_PAC_INTO_SCS for microdroid Disable CONFIG_ARM64_BTI_KERNEL since significant overhead has been observed on systems that don't have BTI/PAC hardware support due to increased number of NOPs added by these features. BTI is not as important in kernels that have CFI enabled because the protection these features offer overlap. Keep PAC enabled and also enable dynamic SCS (CONFIG_UNWIND_PATCH_PAC_INTO_SCS) which is available starting in v6.2. This removes SCS overhead on systems that support PAC, and PAC overhead on systems that need SCS instead. This feature uses runtime code patching, so it won't have the overhead of additional NOPs. Bug: 267119345 Bug: 431251829 Signed-off-by: Isaac J. Manjarres (cherry picked from https://android-review.googlesource.com/q/commit:6688be0f3ddf7c86eabac585885005ff294ed0b0) Merged-In: I8ace99b5edf377e5efd703784dc9e28641ff546e Change-Id: I8ace99b5edf377e5efd703784dc9e28641ff546e --- arch/arm64/configs/microdroid_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/configs/microdroid_defconfig b/arch/arm64/configs/microdroid_defconfig index 250c119b037a..95f7453fe20d 100644 --- a/arch/arm64/configs/microdroid_defconfig +++ b/arch/arm64/configs/microdroid_defconfig @@ -29,8 +29,10 @@ CONFIG_NR_CPUS=32 CONFIG_PARAVIRT_TIME_ACCOUNTING=y CONFIG_KEXEC_FILE=y CONFIG_ARM64_SW_TTBR0_PAN=y +# CONFIG_ARM64_BTI_KERNEL is not set CONFIG_RANDOMIZE_BASE=y # CONFIG_RANDOMIZE_MODULE_REGION_FULL is not set +CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off cgroup_disable=pressure ioremap_guard panic=-1 bootconfig" CONFIG_CMDLINE_EXTEND=y # CONFIG_EFI is not set