ANDROID: bpf: disable CFI for dispatcher functions

BPF dispatcher functions are patched at runtime to perform direct
instead of indirect calls. Disable CFI for the dispatcher functions
to avoid conflicts.

(re-add due to merge conflicts previously)

Bug: 145210207
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7edf6052e121d16ccb0f3d3492ff4eefedfa509e
This commit is contained in:
Sami Tolvanen
2020-01-31 08:23:52 +01:00
committed by Greg Kroah-Hartman
parent c37185c6d3
commit 8be5d29b7b

View File

@@ -512,7 +512,7 @@ struct bpf_dispatcher {
u32 image_off;
};
static __always_inline unsigned int bpf_dispatcher_nopfunc(
static __always_inline __nocfi unsigned int bpf_dispatcher_nopfunc(
const void *ctx,
const struct bpf_insn *insnsi,
unsigned int (*bpf_func)(const void *,
@@ -535,7 +535,7 @@ void bpf_trampoline_put(struct bpf_trampoline *tr);
}
#define DEFINE_BPF_DISPATCHER(name) \
noinline unsigned int name##func( \
noinline __nocfi unsigned int name##func( \
const void *ctx, \
const struct bpf_insn *insnsi, \
unsigned int (*bpf_func)(const void *, \