Skip to content

Commit 9f5b400

Browse files
samitolvanenkees
authored andcommitted
bpf: disable CFI in 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. 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-9-samitolvanen@google.com
1 parent 8b8e6b5 commit 9f5b400

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/linux/bpf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ struct bpf_dispatcher {
650650
struct bpf_ksym ksym;
651651
};
652652

653-
static __always_inline unsigned int bpf_dispatcher_nop_func(
653+
static __always_inline __nocfi unsigned int bpf_dispatcher_nop_func(
654654
const void *ctx,
655655
const struct bpf_insn *insnsi,
656656
unsigned int (*bpf_func)(const void *,
@@ -678,7 +678,7 @@ void bpf_trampoline_put(struct bpf_trampoline *tr);
678678
}
679679

680680
#define DEFINE_BPF_DISPATCHER(name) \
681-
noinline unsigned int bpf_dispatcher_##name##_func( \
681+
noinline __nocfi unsigned int bpf_dispatcher_##name##_func( \
682682
const void *ctx, \
683683
const struct bpf_insn *insnsi, \
684684
unsigned int (*bpf_func)(const void *, \

0 commit comments

Comments
 (0)