Skip to content

Commit 9562f3d

Browse files
samitolvanenkees
authored andcommitted
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 non-canonical CFI, the compiler won't replace these function references with the jump table addresses, which trips CFI. Disable CFI checking in the function to work around the issue. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210408182843.1754385-16-samitolvanen@google.com
1 parent cbdac84 commit 9562f3d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/arm64/kernel/alternative.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ static void clean_dcache_range_nopatch(u64 start, u64 end)
133133
} while (cur += d_size, cur < end);
134134
}
135135

136-
static void __apply_alternatives(void *alt_region, bool is_module,
137-
unsigned long *feature_mask)
136+
static void __nocfi __apply_alternatives(void *alt_region, bool is_module,
137+
unsigned long *feature_mask)
138138
{
139139
struct alt_instr *alt;
140140
struct alt_region *region = alt_region;

0 commit comments

Comments
 (0)