From: Amery Hung <ameryhung@gmail.com>
To: bpf@vger.kernel.org
Cc: alexei.starovoitov@gmail.com, andrii@kernel.org,
daniel@iogearbox.net, eddyz87@gmail.com, memxor@gmail.com,
ameryhung@gmail.com, kernel-team@meta.com
Subject: [PATCH bpf-next v3 00/11] Unify subprog argument checks
Date: Mon, 28 Sep 2026 11:53:23 -0700 [thread overview]
Message-ID: <20260928185334.1004200-1-ameryhung@gmail.com> (raw)
Hi,
Helper and kfunc calls now validate arguments through check_func_args(),
while subprog calls still duplicate much of the same validation in
btf_check_func_arg_match(). This makes common argument rules and
diagnostics easy to change for one call kind without updating the other.
This series builds a temporary helper-style argument prototype from the
subprog's cached BTF metadata, then moves each supported argument class to
the common checker. The last patch removes the duplicate loop.
The series is organized as follows:
- Patch 1 fixes kfunc BTF parameter lookups after wide arguments.
- Patches 2-3 identify subprog calls in common metadata and generate the
temporary argument prototype.
- Patches 4-9 move scalar, untrusted, context, arena, dynptr, and BTF-ID
arguments to the common path.
- Patch 10 moves global subprog memory arguments and their packet-change
check to the common path.
- Patch 11 removes the legacy loop and checks all subprog arguments through
check_func_args().
This follows the helper/kfunc argument-checking consolidation:
https://lore.kernel.org/bpf/20260911220415.1396439-1-ameryhung@gmail.com/
v2 -> v3:
- Remove the redundant dynptr register-type check from
process_dynptr_func() after all callers begin using check_func_arg()
(Sashiko)
Link: https://lore.kernel.org/bpf/20260928181414.644158-1-ameryhung@gmail.com/
v1 -> v2:
- Extend patch 1 to fix the release and iterator BTF parameter lookups
after wide arguments (Alexei)
- Keep subprog call metadata local to argument checking, leaving callers
and helper/kfunc handling unchanged (Alexei)
Link: https://lore.kernel.org/bpf/20260925211256.1834061-1-ameryhung@gmail.com/
Amery Hung (11):
bpf: Fix kfunc BTF parameter lookups after wide arguments
bpf: Identify subprog calls in argument metadata
bpf: Build argument prototypes for subprog calls
bpf: Check subprog scalar arguments in the common path
bpf: Check global subprog untrusted arguments in the common path
bpf: Check subprog context arguments in the common path
bpf: Check subprog arena arguments in the common path
bpf: Check subprog dynptr arguments in the common path
bpf: Check global subprog BTF-ID arguments in the common path
bpf: Check global subprog memory arguments in the common path
bpf: Check all subprog arguments in the common path
include/linux/bpf_verifier.h | 6 +-
kernel/bpf/verifier.c | 283 +++++++-----------
.../selftests/bpf/progs/aggregate_arg_func.c | 2 +-
.../testing/selftests/bpf/progs/dynptr_fail.c | 11 +-
.../selftests/bpf/progs/test_global_func5.c | 2 +-
.../bpf/progs/verifier_global_ptr_args.c | 7 +-
.../bpf/progs/verifier_global_subprogs.c | 2 +-
7 files changed, 129 insertions(+), 184 deletions(-)
--
2.52.0
next reply other threads:[~2026-09-28 18:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:53 Amery Hung [this message]
2026-09-28 18:53 ` [PATCH bpf-next v3 01/11] bpf: Fix kfunc BTF parameter lookups after wide arguments Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 02/11] bpf: Identify subprog calls in argument metadata Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 03/11] bpf: Build argument prototypes for subprog calls Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 04/11] bpf: Check subprog scalar arguments in the common path Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 05/11] bpf: Check global subprog untrusted " Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 06/11] bpf: Check subprog context " Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 07/11] bpf: Check subprog arena " Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 08/11] bpf: Check subprog dynptr " Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 09/11] bpf: Check global subprog BTF-ID " Amery Hung
2026-09-28 18:53 ` [PATCH bpf-next v3 10/11] bpf: Check global subprog memory " Amery Hung
2026-09-28 19:53 ` bot+bpf-ci
2026-09-28 18:53 ` [PATCH bpf-next v3 11/11] bpf: Check all subprog " Amery Hung
2026-09-29 10:40 ` [PATCH bpf-next v3 00/11] Unify subprog argument checks patchwork-bot+netdevbpf
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=20260928185334.1004200-1-ameryhung@gmail.com \
--to=ameryhung@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=memxor@gmail.com \
/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