From: Jiri Olsa <jolsa@redhat.com>
To: Alexei Starovoitov <ast@kernel.org>
Cc: davem@davemloft.net, daniel@iogearbox.net,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next] bpf: Fix bpf jit kallsym access
Date: Thu, 31 Oct 2019 11:22:29 +0100 [thread overview]
Message-ID: <20191031102229.GA2794@krava> (raw)
In-Reply-To: <20191030233019.1187404-1-ast@kernel.org>
On Wed, Oct 30, 2019 at 04:30:19PM -0700, Alexei Starovoitov wrote:
> 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.
>
> Reported-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> Fixes: 3dec541b2e63 ("bpf: Add support for BTF pointers to x86 JIT")
it fixes the crash for me, thanks for quick fix
jirka
> ---
> kernel/bpf/core.c | 3 ---
> 1 file changed, 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 :
> --
> 2.17.1
>
prev parent reply other threads:[~2019-10-31 10:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 23:30 [PATCH bpf-next] bpf: Fix bpf jit kallsym access Alexei Starovoitov
2019-10-31 1:03 ` Daniel Borkmann
2019-10-31 10:22 ` Jiri Olsa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191031102229.GA2794@krava \
--to=jolsa@redhat.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox