All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andriin@fb.com>,
	kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCHv3 bpf-next 3/7] bpf: Add bpf_get_func_ip helper for tracing programs
Date: Sun, 11 Jul 2021 16:48:26 +0200	[thread overview]
Message-ID: <YOsEusl1MLaVJuF/@krava> (raw)
In-Reply-To: <CAEf4BzaF5Y6gbineUd-WLvbZQMSbR3v4j3zct3Qyq31OzWNnwA@mail.gmail.com>

On Wed, Jul 07, 2021 at 05:06:17PM -0700, Andrii Nakryiko wrote:
> On Wed, Jul 7, 2021 at 2:53 PM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > Adding bpf_get_func_ip helper for BPF_PROG_TYPE_TRACING programs,
> > specifically for all trampoline attach types.
> >
> > The trampoline's caller IP address is stored in (ctx - 8) address.
> > so there's no reason to actually call the helper, but rather fixup
> > the call instruction and return [ctx - 8] value directly (suggested
> > by Alexei).
> >
> > [fixed has_get_func_ip wrong return type]
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  include/uapi/linux/bpf.h       |  7 +++++
> >  kernel/bpf/verifier.c          | 53 ++++++++++++++++++++++++++++++++++
> >  kernel/trace/bpf_trace.c       | 15 ++++++++++
> >  tools/include/uapi/linux/bpf.h |  7 +++++
> >  4 files changed, 82 insertions(+)
> >
> 
> [...]
> 
> >  static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
> >                              int *insn_idx_p)
> >  {
> > @@ -6225,6 +6256,12 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
> >         if (func_id == BPF_FUNC_get_stackid || func_id == BPF_FUNC_get_stack)
> >                 env->prog->call_get_stack = true;
> >
> > +       if (func_id == BPF_FUNC_get_func_ip) {
> > +               if (has_get_func_ip(env))
> 
> from has_xxx name I'd expect it returns true/false, so this reads
> super confusing. check_get_func_ip would be a bit more consistent with
> other cases like this (still reads confusing to me, but that's ok)

ok, will change

jirka

> 
> > +                       return -ENOTSUPP;
> > +               env->prog->call_get_func_ip = true;
> > +       }
> > +
> >         if (changes_data)
> >                 clear_all_pkt_pointers(env);
> >         return 0;
> 
> [...]
> 


  reply	other threads:[~2021-07-11 14:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 21:47 [PATCHv3 bpf-next 0/7] bpf, x86: Add bpf_get_func_ip helper Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 1/7] bpf, x86: Store caller's ip in trampoline stack Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 2/7] bpf: Enable BPF_TRAMP_F_IP_ARG for trampolines with call_get_func_ip Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 3/7] bpf: Add bpf_get_func_ip helper for tracing programs Jiri Olsa
2021-07-08  0:06   ` Andrii Nakryiko
2021-07-11 14:48     ` Jiri Olsa [this message]
2021-07-08  2:11   ` Alexei Starovoitov
2021-07-11 14:48     ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 4/7] bpf: Add bpf_get_func_ip helper for kprobe programs Jiri Olsa
2021-07-10  7:55   ` Masami Hiramatsu
2021-07-11 14:48     ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 5/7] selftests/bpf: Add test for bpf_get_func_ip helper Jiri Olsa
2021-07-08  0:12   ` Andrii Nakryiko
2021-07-11 14:48     ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 6/7] libbpf: allow specification of "kprobe/function+offset" Jiri Olsa
2021-07-08  0:14   ` Andrii Nakryiko
2021-07-11 14:48     ` Jiri Olsa
2021-07-07 21:47 ` [PATCHv3 bpf-next 7/7] selftests/bpf: Add test for bpf_get_func_ip in kprobe+offset probe Jiri Olsa
2021-07-08  0:18   ` Andrii Nakryiko
2021-07-11 14:48     ` Jiri Olsa
2021-07-12 23:32       ` Andrii Nakryiko
2021-07-13 14:15         ` Jiri Olsa

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=YOsEusl1MLaVJuF/@krava \
    --to=jolsa@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.