[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaF5Y6gbineUd-WLvbZQMSbR3v4j3zct3Qyq31OzWNnwA@mail.gmail.com>
Date: Wed, 7 Jul 2021 17:06:17 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
kernel test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>
Subject: Re: [PATCHv3 bpf-next 3/7] bpf: Add bpf_get_func_ip helper for
tracing programs
On Wed, Jul 7, 2021 at 2:53 PM Jiri Olsa <jolsa@...hat.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@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Jiri Olsa <jolsa@...nel.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)
> + return -ENOTSUPP;
> + env->prog->call_get_func_ip = true;
> + }
> +
> if (changes_data)
> clear_all_pkt_pointers(env);
> return 0;
[...]
Powered by blists - more mailing lists