Skip to content

Commit af91acb

Browse files
Alexei Starovoitovborkmann
Alexei Starovoitov
authored andcommitted
bpf: Fix bpf jit kallsym access
Jiri reported crash when JIT is on, but net.core.bpf_jit_kallsyms is off. bpf_prog_kallsyms_find() was skipping addr->bpf_prog resolution logic in oops and stack traces. That's incorrect. It should only skip addr->name resolution for 'cat /proc/kallsyms'. That's what bpf_jit_kallsyms and bpf_jit_harden protect. Fixes: 3dec541 ("bpf: Add support for BTF pointers to x86 JIT") Reported-by: Jiri Olsa <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent cf204a7 commit af91acb

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

kernel/bpf/core.c

-3
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,6 @@ static struct bpf_prog *bpf_prog_kallsyms_find(unsigned long addr)
668668
{
669669
struct latch_tree_node *n;
670670

671-
if (!bpf_jit_kallsyms_enabled())
672-
return NULL;
673-
674671
n = latch_tree_find((void *)addr, &bpf_tree, &bpf_tree_ops);
675672
return n ?
676673
container_of(n, struct bpf_prog_aux, ksym_tnode)->prog :

0 commit comments

Comments
 (0)