ANDROID: cfi: add __cficanonical and fix PREL32 relocations
With non-canonical CFI, the compiler rewrites function references to point to the CFI jump table for indirect call checking. This won't happen when the address is taken in assembly, and will result in a CFI failure if we jump to the address later in C code. This change adds the __cficanonical attribute, which tells the compiler to switch to a canonical jump table for the function. With canonical CFI, the compiler appends a .cfi postfix to the function name, and points the original symbol to the jump table. This allows addresses taken in assembly code to be used for indirect calls without tripping CFI checks. Bug: 145210207 Change-Id: Iaca9d1d95f59d7169168d89bc10bf71420487a67 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:

committed by
Alistair Delva

parent
2c351bb70a
commit
7bc9b9d25b
@@ -220,8 +220,8 @@ extern bool initcall_debug;
|
||||
__initcall_name(initstub, __iid, id)
|
||||
|
||||
#define __define_initcall_stub(__stub, fn) \
|
||||
int __init __stub(void); \
|
||||
int __init __stub(void) \
|
||||
int __init __cficanonical __stub(void); \
|
||||
int __init __cficanonical __stub(void) \
|
||||
{ \
|
||||
return fn(); \
|
||||
} \
|
||||
|
Reference in New Issue
Block a user