| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| From: Sami Tolvanen <samitolvanen@google.com> |
| Date: Fri, 16 Aug 2019 11:32:43 -0700 |
| Subject: 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: I6cdd164f9315c0aa16a1427ab1a67cfa8aad3ffd |
| Signed-off-by: Sami Tolvanen <samitolvanen@google.com> |
| --- |
| arch/arm64/kernel/alternative.c | 4 ++-- |
| 1 file changed, 2 insertions(+), 2 deletions(-) |
| |
| diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c |
| index d1757ef1b1e7..f1e598d6bc31 100644 |
| --- a/arch/arm64/kernel/alternative.c |
| +++ b/arch/arm64/kernel/alternative.c |
| @@ -144,8 +144,8 @@ 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, |
| - unsigned long *feature_mask) |
| +static void __nocfi __apply_alternatives(void *alt_region, bool is_module, |
| + unsigned long *feature_mask) |
| { |
| struct alt_instr *alt; |
| struct alt_region *region = alt_region; |