diff options
author | Alexei Starovoitov <ast@kernel.org> | 2019-10-31 00:30:19 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-10-31 02:02:29 +0100 |
commit | af91acbc62999d62e2ca1e80f660d20561ca55d3 (patch) | |
tree | 177a248942995dad60bd216381da2be430e17b4d /kernel | |
parent | bpf, testing: Introduce 'gso_linear_no_head_frag' skb_segment test (diff) | |
download | linux-af91acbc62999d62e2ca1e80f660d20561ca55d3.tar.xz linux-af91acbc62999d62e2ca1e80f660d20561ca55d3.zip |
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: 3dec541b2e63 ("bpf: Add support for BTF pointers to x86 JIT")
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191030233019.1187404-1-ast@kernel.org
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/core.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 673f5d40a93e..8d3fbc86ca5e 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -668,9 +668,6 @@ static struct bpf_prog *bpf_prog_kallsyms_find(unsigned long addr) { struct latch_tree_node *n; - if (!bpf_jit_kallsyms_enabled()) - return NULL; - n = latch_tree_find((void *)addr, &bpf_tree, &bpf_tree_ops); return n ? container_of(n, struct bpf_prog_aux, ksym_tnode)->prog : |