arm64: add __nocfi to __apply_alternatives
authorSami Tolvanen <samitolvanen@google.com>
Thu, 8 Apr 2021 18:28:40 +0000 (11:28 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 8 Apr 2021 23:04:23 +0000 (16:04 -0700)
commit9562f3dc6f502d78fd5c8c56f5826e93b781bd46
treeabc24fa2fbbd466329211e1b16e3120d100b2d49
parentcbdac8413e33bd1b9de45eeb10221c4686d743a6
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
arch/arm64/kernel/alternative.c