From: sashiko-bot@kernel.org
To: "Nuoqi Gui" <gnq25@mails.tsinghua.edu.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add cross-subprog gotox target coverage
Date: Tue, 09 Jun 2026 15:40:07 +0000 [thread overview]
Message-ID: <20260609154008.1ED4F1F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20260609-f01-02-gotox-bpf-next-v1-2-b441d63a1559@mails.tsinghua.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test `check_cross_subprog_gotox_target` incorrectly expects `bpf_prog_load` to fail with `-EACCES`, but the verifier actually rejects cross-subprog jump targets with `-EINVAL`, causing a false test failure.
--
commit f7ef2af9b62d2a415c2072928a61150823abda72
Author: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
selftests/bpf: Add cross-subprog gotox target coverage
This commit adds a gotox regression test with two one-entry INSN_ARRAY maps
to verify that the control flow graph handles indirect jumps correctly. It
ensures that when a verified path loads a map whose target points to another
subprog, the program load is rejected.
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_gotox.c b/tools/testing/selftests/bpf/prog_tests/bpf_gotox.c
> index 73dc63882b7d5..866b4a14ccb7c 100644
> --- a/tools/testing/selftests/bpf/prog_tests/bpf_gotox.c
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_gotox.c
[ ... ]
> @@ -393,6 +417,52 @@ reject_offsets(struct bpf_insn *insns, __u32 insn_cnt, int off1, int off2, int o
> close(prog_fd);
> }
>
> +static void
> +check_cross_subprog_gotox_target(struct bpf_gotox *skel __always_unused)
> +{
[ ... ]
> + prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, NULL, "GPL",
> + insns, ARRAY_SIZE(insns), NULL);
> + if (!ASSERT_EQ(prog_fd, -EACCES, "cross_subprog_gotox_prog_load"))
[Severity: Medium]
Will this assertion fail because the verifier returns -EINVAL instead of
-EACCES?
When the verifier inspects the gotox target via check_indirect_jump(), the
target fails the is_cfg_indirect_jump_target() check. This causes the
verifier to explicitly reject the load with -EINVAL.
The memory access itself passes the verifier's check_map_access() bounds
check since it reads from a valid offset, so we don't get the -EACCES return
value here.
Should this test expect -EINVAL instead?
> + close(prog_fd);
> +
> + close(bad_fd);
> + close(good_fd);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-f01-02-gotox-bpf-next-v1-0-b441d63a1559@mails.tsinghua.edu.cn?part=2
next prev parent reply other threads:[~2026-06-09 15:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 15:03 [PATCH bpf-next 0/2] bpf: Fix gotox target validation against CFG Nuoqi Gui
2026-06-09 15:03 ` [PATCH bpf-next 1/2] " Nuoqi Gui
2026-06-09 15:13 ` sashiko-bot
2026-06-09 15:42 ` bot+bpf-ci
2026-06-09 15:56 ` Anton Protopopov
2026-06-09 17:27 ` Eduard Zingerman
2026-06-09 15:03 ` [PATCH bpf-next 2/2] selftests/bpf: Add cross-subprog gotox target coverage Nuoqi Gui
2026-06-09 15:40 ` sashiko-bot [this message]
2026-06-09 15:42 ` bot+bpf-ci
2026-06-09 16:14 ` Anton Protopopov
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=20260609154008.1ED4F1F0089B@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=gnq25@mails.tsinghua.edu.cn \
--cc=sashiko-reviews@lists.linux.dev \
/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