[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZV4AS2w5iXhTh+hEA1W+6uxHv7sJ9hAUvpUiBFbuOC+Q@mail.gmail.com>
Date: Thu, 10 Oct 2024 19:19:49 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, 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>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu <mhiramat@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCHv6 bpf-next 03/16] bpf: Allow return values 0 and 1 for
kprobe session
On Thu, Oct 10, 2024 at 1:10 PM Jiri Olsa <jolsa@...nel.org> wrote:
>
> The kprobe session program can return only 0 or 1,
> instruct verifier to check for that.
>
> Fixes: 535a3692ba72 ("bpf: Add support for kprobe session attach")
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
> kernel/bpf/verifier.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 7d9b38ffd220..787008872a14 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -15910,6 +15910,15 @@ static int check_return_code(struct bpf_verifier_env *env, int regno, const char
> return -ENOTSUPP;
> }
> break;
> + case BPF_PROG_TYPE_KPROBE:
> + switch (env->prog->expected_attach_type) {
> + case BPF_TRACE_KPROBE_SESSION:
> + range = retval_range(0, 1);
> + break;
> + default:
> + return 0;
> + }
> + break;
> case BPF_PROG_TYPE_SK_LOOKUP:
> range = retval_range(SK_DROP, SK_PASS);
> break;
> --
> 2.46.2
>
Powered by blists - more mailing lists