From: Eduard Zingerman <eddyz87@gmail.com>
To: Puranjay Mohan <puranjay@kernel.org>, bpf@vger.kernel.org
Cc: Puranjay Mohan <puranjay12@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
kernel-team@meta.com
Subject: Re: [PATCH bpf-next] bpf: Replace __opt annotation with __nullable for kfuncs
Date: Fri, 02 Jan 2026 13:03:45 -0800 [thread overview]
Message-ID: <ec04d110c596af4020d831d3c602371ecf4f3cac.camel@gmail.com> (raw)
In-Reply-To: <20251231232623.2713255-1-puranjay@kernel.org>
On Wed, 2025-12-31 at 15:26 -0800, Puranjay Mohan wrote:
> The __opt annotation was originally introduced specifically for
> buffer/size argument pairs in bpf_dynptr_slice() and
> bpf_dynptr_slice_rdwr(), allowing the buffer pointer to be NULL while
> still validating the size as a constant. The __nullable annotation
> serves the same purpose but is more general and is already used
> throughout the BPF subsystem for raw tracepoints, struct_ops, and other
> kfuncs.
>
> This patch unifies the two annotations by replacing __opt with
> __nullable. The key change is in the verifier's
> get_kfunc_ptr_arg_type() function, where mem/size pair detection is now
> performed before the nullable check. This ensures that buffer/size
> pairs are correctly classified as KF_ARG_PTR_TO_MEM_SIZE even when the
> buffer is nullable, while adding an !arg_mem_size condition to the
> nullable check prevents interference with mem/size pair handling.
>
> When processing KF_ARG_PTR_TO_MEM_SIZE arguments, the verifier now uses
> is_kfunc_arg_nullable() instead of the removed is_kfunc_arg_optional()
> to determine whether to skip size validation for NULL buffers.
>
> This is the first documentation added for the __nullable annotation,
> which has been in use since it was introduced but was previously
> undocumented.
>
> No functional changes to verifier behavior - nullable buffer/size pairs
> continue to work exactly as before.
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---
Lgtm, thank you for the quick turnaround.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
[...]
next prev parent reply other threads:[~2026-01-02 21:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 23:26 [PATCH bpf-next] bpf: Replace __opt annotation with __nullable for kfuncs Puranjay Mohan
2026-01-02 21:03 ` Eduard Zingerman [this message]
2026-01-02 21:05 ` Puranjay Mohan
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=ec04d110c596af4020d831d3c602371ecf4f3cac.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=mykyta.yatsenko5@gmail.com \
--cc=puranjay12@gmail.com \
--cc=puranjay@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