From: Eduard Zingerman <eddyz87@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Emil Tsalapatis <emil@etsalapatis.com>,
Amery Hung <ameryhung@gmail.com>,
kkd@meta.com, kernel-team@meta.com
Subject: Re: [PATCH bpf-next v3 2/5] bpf: Fix generic __uninit kfunc output buffers
Date: Thu, 17 Sep 2026 12:29:31 -0700 [thread overview]
Message-ID: <5e9f4e3ebc09b18449bf4f5ac975747ba9fba64f.camel@gmail.com> (raw)
In-Reply-To: <20260916192805.3991983-3-memxor@gmail.com>
On Wed, 2026-09-16 at 21:27 +0200, Kumar Kartikeya Dwivedi wrote:
...
> @@ -8885,6 +8889,16 @@ static int process_map_ptr_arg(struct bpf_verifier_env *env, struct bpf_reg_stat
> return 0;
> }
>
> +static enum bpf_access_type func_arg_access_type(enum bpf_arg_type arg_type,
> + const struct bpf_call_arg_meta *meta)
> +{
> + if (arg_type & MEM_UNINIT)
> + return BPF_WRITE;
> + if (meta->btf)
> + return BPF_READ | BPF_WRITE;
> + return arg_type & MEM_WRITE ? BPF_WRITE : BPF_READ;
> +}
> +
> static int check_func_arg(struct bpf_verifier_env *env, u32 arg, u32 slot, u32 prev_slot,
> struct bpf_call_arg_meta *meta,
> int insn_idx)
> @@ -9176,15 +9190,16 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg, u32 slot, u32 p
> enum bpf_access_type access_type;
> bool known_memory;
>
> + if (meta->btf && (arg_type & MEM_UNINIT))
> + meta->arg_raw_mem.regno = slot + 1;
> +
Let's avoid adding special cases for kfuncs as in two hunks above.
Please consider a rework as in [1], which makes processing of the
arg_raw_mem.regno and MEM_WRITE bit identical for kfuncs and helpers.
The details are in commit messages (partial slop).
Not identified incorrect handling of MEM_WRITE for helpers
(MEM_WRITE should imply MEM_READ).
[1] https://github.com/eddyz87/bpf/tree/kfunc-uninit-tweaks
...
next prev parent reply other threads:[~2026-09-17 19:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 19:27 [PATCH bpf-next v3 0/5] Fix generic __uninit kfunc output buffers Kumar Kartikeya Dwivedi
2026-09-16 19:27 ` [PATCH bpf-next v3 1/5] selftests/bpf: Allow privileged preparation for capability tests Kumar Kartikeya Dwivedi
2026-09-16 19:27 ` [PATCH bpf-next v3 2/5] bpf: Fix generic __uninit kfunc output buffers Kumar Kartikeya Dwivedi
2026-09-16 19:52 ` Amery Hung
2026-09-16 20:27 ` Amery Hung
2026-09-16 20:27 ` bot+bpf-ci
2026-09-17 19:29 ` Eduard Zingerman [this message]
2026-09-16 19:28 ` [PATCH bpf-next v3 3/5] selftests/bpf: Cover generic __uninit output initialization Kumar Kartikeya Dwivedi
2026-09-16 20:05 ` Amery Hung
2026-09-16 20:27 ` bot+bpf-ci
2026-09-16 19:28 ` [PATCH bpf-next v3 4/5] bpf: Support multiple __uninit kfunc output arguments Kumar Kartikeya Dwivedi
2026-09-16 19:28 ` [PATCH bpf-next v3 5/5] selftests/bpf: Cover __uninit kfunc output argument slots Kumar Kartikeya Dwivedi
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=5e9f4e3ebc09b18449bf4f5ac975747ba9fba64f.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=emil@etsalapatis.com \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=memxor@gmail.com \
--cc=tj@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