From 08f2c5a5a912caaff0279aff3d7d3e00be2007ad Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Fri, 16 Aug 2019 11:32:43 -0700 Subject: [PATCH] ANDROID: arm64: add __nocfi to __apply_alternatives __apply_alternatives makes indirect calls to functions whose address is taken in assembly code using the alternative_cb macro. With CFI enabled using non-canonical jump tables, the compiler isn't able to replace the function reference with the jump table reference, which trips CFI. Bug: 145210207 Change-Id: I088faf94b64ac3068ac798dd8e5029cb2ab92903 Signed-off-by: Sami Tolvanen --- arch/arm64/kernel/alternative.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index b5d603992d40..845f9bdddb76 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -145,7 +145,7 @@ static void clean_dcache_range_nopatch(u64 start, u64 end) } while (cur += d_size, cur < end); } -static void __apply_alternatives(void *alt_region, bool is_module) +static void __nocfi __apply_alternatives(void *alt_region, bool is_module) { struct alt_instr *alt; struct alt_region *region = alt_region;