From: "Nuoqi Gui" <gnq25@mails.tsinghua.edu.cn>
To: "Anton Protopopov" <a.s.protopopov@gmail.com>
Cc: bpf@vger.kernel.org, "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Shuah Khan" <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH bpf-next v2 0/2] bpf: Enforce gotox targets against subprog bounds
Date: Tue, 23 Jun 2026 16:56:05 +0800 (GMT+08:00) [thread overview]
Message-ID: <4ef3f4bd.84fbc.19ef3b1a209.Coremail.gnq25@mails.tsinghua.edu.cn> (raw)
In-Reply-To: <ajlSDq+bBo0I34ZK@mail.gmail.com>
> -----Original Messages-----
> From: "Anton Protopopov" <a.s.protopopov@gmail.com>
> Send time:Monday, 22/06/2026 23:17:34
> To: "Nuoqi Gui" <gnq25@mails.tsinghua.edu.cn>
> Cc: bpf@vger.kernel.org, "Alexei Starovoitov" <ast@kernel.org>, "Daniel Borkmann" <daniel@iogearbox.net>, "Andrii Nakryiko" <andrii@kernel.org>, "Eduard Zingerman" <eddyz87@gmail.com>, "Shuah Khan" <shuah@kernel.org>, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
> Subject: Re: [PATCH bpf-next v2 0/2] bpf: Enforce gotox targets against subprog bounds
>
> On 26/06/13 05:33PM, Nuoqi Gui wrote:
> > For gotox, CFG construction models the indirect-jump target set in
> > insn_aux_data->jt, but do_check() later follows targets from the runtime
> > PTR_TO_INSN register's own INSN_ARRAY map. If the same gotox can be
> > reached with PTR_TO_INSN values from different maps, do_check() can accept
> > a target outside the subprog that CFG allowed for the gotox instruction.
> >
> > On x86, that can transfer control into another subprog without a matching
> > BPF call frame and crash when the program is run.
>
> Why only on x86?
>
I will avoid making the x86 wording sound like the verifier issue is x86-specific.
The issue was observed through the x86 JIT path, but the invariant being fixed is
the generic gotox subprog-boundary check.
> > Fix this by rejecting gotox map targets outside the current gotox subprog.
> > Add a regression test covering the two-map cross-subprog case.
> >
> > Validation:
> >
> > unpatched bpf-next 7bfb93e3475b with the new selftest:
> > bpf_gotox/check-cross-subprog-gotox-target: FAIL
> > cross_subprog_gotox_prog_load: actual 23 != expected -22
> > __TEST_PROGS_RC__=1
> >
> > patched bpf-next 7bfb93e3475b + this series:
> > bpf_gotox/check-cross-subprog-gotox-target: OK
> > ./test_progs -t bpf_gotox/check-cross-subprog-gotox-target
> > Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED
> > __TEST_PROGS_RC__=0
>
> Why the second part mentions the call to ./test_progs, and the first doesn't?
> Why the test result goes before the test run? Is this "Validation" section even required?
>
Agreed, the Validation section is not needed in the cover letter. I will drop it
in v3 instead of trying to keep the command/output formatting there.
> > v1 -> v2:
> > - Validate gotox runtime targets against the current subprog bounds instead
> > of scanning the CFG jump table.
> > - Fix the selftest expected error from -EACCES to -EINVAL.
> >
> > v1:
> > https://lore.kernel.org/bpf/20260609-f01-02-gotox-bpf-next-v1-0-b441d63a1559@mails.tsinghua.edu.cn/
> >
> > Signed-off-by: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
> > ---
> > Nuoqi Gui (2):
> > bpf: Enforce gotox targets against subprog bounds
> > selftests/bpf: Add cross-subprog gotox target coverage
> >
> > kernel/bpf/verifier.c | 21 +++++++
> > tools/testing/selftests/bpf/prog_tests/bpf_gotox.c | 73 ++++++++++++++++++++++
> > 2 files changed, 94 insertions(+)
> > ---
> > base-commit: 7bfb93e3475be9de894f1cecd3a727d3e1649b03
> > change-id: 20260613-f01-02-gotox-bpf-next-v2-send-8c48c9357dde
> >
> > Best regards,
> > --
> > Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
> >
prev parent reply other threads:[~2026-06-23 8:56 UTC|newest]
Thread overview: 21+ 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:42 ` bot+bpf-ci
2026-06-09 15:56 ` Anton Protopopov
2026-06-09 17:27 ` Eduard Zingerman
2026-06-10 12:22 ` Nuoqi Gui
2026-06-09 15:03 ` [PATCH bpf-next 2/2] selftests/bpf: Add cross-subprog gotox target coverage Nuoqi Gui
2026-06-09 15:42 ` bot+bpf-ci
2026-06-09 16:14 ` Anton Protopopov
2026-06-13 9:33 ` [PATCH bpf-next v2 0/2] bpf: Enforce gotox targets against subprog bounds Nuoqi Gui
2026-06-13 9:33 ` [PATCH bpf-next v2 1/2] " Nuoqi Gui
2026-06-21 15:20 ` Yonghong Song
2026-06-22 15:08 ` Anton Protopopov
2026-06-22 18:06 ` Eduard Zingerman
2026-06-13 9:33 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add cross-subprog gotox target coverage Nuoqi Gui
2026-06-13 10:08 ` bot+bpf-ci
2026-06-21 15:21 ` Yonghong Song
2026-06-22 14:40 ` Anton Protopopov
2026-06-23 9:11 ` Nuoqi Gui
2026-06-22 15:17 ` [PATCH bpf-next v2 0/2] bpf: Enforce gotox targets against subprog bounds Anton Protopopov
2026-06-23 8:56 ` Nuoqi Gui [this message]
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=4ef3f4bd.84fbc.19ef3b1a209.Coremail.gnq25@mails.tsinghua.edu.cn \
--to=gnq25@mails.tsinghua.edu.cn \
--cc=a.s.protopopov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@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