From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: "Eduard Zingerman" <eddyz87@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>, <kkd@meta.com>,
<kernel-team@meta.com>
Subject: Re: [PATCH bpf-next v1 1/3] bpf: Fix generic __uninit kfunc output buffers
Date: Wed, 16 Sep 2026 18:08:00 +0200 [thread overview]
Message-ID: <DLGVCMQKS83E.1XOH6G05DWBP0@gmail.com> (raw)
In-Reply-To: <309af9b05e49a62f0a721cbe04673468f11e64f4.camel@gmail.com>
On Wed Sep 16, 2026 at 7:19 AM CEST, Eduard Zingerman wrote:
> On Tue, 2026-09-15 at 16:10 +0200, Kumar Kartikeya Dwivedi wrote:
>
> ...
>
>> 2.3.4 __nullable Annotation
>> ---------------------------
>> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
>> index cf85141ea167..9ddbb20ec1e9 100644
>> --- a/include/linux/bpf_verifier.h
>> +++ b/include/linux/bpf_verifier.h
>> @@ -1547,12 +1547,13 @@ struct ref_obj_desc {
>> };
>>
>> /*
>> - * A memory argument a call fills in. The verifier allows the stack to be uninitialized if
>> - * the range is a known constant. Stack slots are marked as STACK_MISC by check_mem_access().
>> + * Memory arguments a call fills in, indexed by argument slot. The verifier allows the
>> + * stack to be uninitialized if the range is a known constant. Stack slots are marked as
>> + * STACK_MISC by check_mem_access() after all arguments have been checked.
>> */
>> struct arg_raw_mem_desc {
>> - u8 regno;
>> - int size;
>> + u16 mask;
>
> Do we plan to add kfuncs with multiple __uninit parameters?
> If we do plan this, let's separate __uninit fix from the mask conversion.
> Otherwise let's keep regno.
>
I separated the patches. I don't think are any consumers yet but it makes to
support multiple such arguments, so just keeping the separate patch. If you
disagree feel free to drop it when applying.
>> + int size[MAX_BPF_FUNC_ARGS];
>> };
>>
>> /* Size of PTR_TO_MEM returned, taken from a constant allocation-size argument */
>
> ...
>
>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
>> index 6c6b8d8520cd..070ec5daeec3 100644
>> --- a/kernel/bpf/verifier.c
>> +++ b/kernel/bpf/verifier.c
>> @@ -6981,7 +6981,9 @@ static int check_stack_range_initialized(
>> */
>> bool allow_poison = access_size < 0 || clobber;
>> /* The call will initialize the memory; uninitialized stack allowed */
>> - bool raw_mode = meta && meta->arg_raw_mem.regno == reg_from_argno(argno);
>> + u32 arg_slot = abs(argno.argno) - 1;
>> + bool raw_mode = meta && arg_slot < MAX_BPF_FUNC_ARGS &&
>> + (meta->arg_raw_mem.mask & BIT(arg_slot));
>
> Thit BIT(abs(...)) trick is repeated several times, can it be abstracted?
>
> ...
For the other email, I decided to keep __prepare_priv, we need to resolve module
ksym kfuncs but test the unpriv case. It is a bit of a hack and nobody will do
this in practice, but it helps us retain coverage for the other case.
Addressed all other comments and will respin.
next prev parent reply other threads:[~2026-09-16 16:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 14:10 [PATCH bpf-next v1 0/3] Fix generic __uninit kfunc output buffers Kumar Kartikeya Dwivedi
2026-09-15 14:10 ` [PATCH bpf-next v1 1/3] bpf: " Kumar Kartikeya Dwivedi
2026-09-15 14:24 ` sashiko-bot
2026-09-15 17:20 ` Amery Hung
2026-09-16 5:19 ` Eduard Zingerman
2026-09-16 16:08 ` Kumar Kartikeya Dwivedi [this message]
2026-09-15 14:10 ` [PATCH bpf-next v1 2/3] selftests/bpf: Allow privileged preparation for capability tests Kumar Kartikeya Dwivedi
2026-09-15 15:01 ` bot+bpf-ci
2026-09-15 14:10 ` [PATCH bpf-next v1 3/3] selftests/bpf: Cover generic __uninit kfunc output buffers Kumar Kartikeya Dwivedi
2026-09-15 15:01 ` bot+bpf-ci
2026-09-16 5:56 ` Eduard Zingerman
2026-09-15 14:14 ` [PATCH bpf-next v1 0/3] Fix " 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=DLGVCMQKS83E.1XOH6G05DWBP0@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=kernel-team@meta.com \
--cc=kkd@meta.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 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.