From: Anton Protopopov <a.s.protopopov@gmail.com>
To: bot+bpf-ci@kernel.org
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
aspsk@isovalent.com, daniel@iogearbox.net, eddyz87@gmail.com,
qmo@kernel.org, yonghong.song@linux.dev, martin.lau@kernel.org,
clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH v8 bpf-next 10/11] selftests/bpf: add new verifier_gotox test
Date: Tue, 28 Oct 2025 15:05:42 +0000 [thread overview]
Message-ID: <aQDbxmPEkOuVcQV1@mail.gmail.com> (raw)
In-Reply-To: <33646aa56766cac6c6915ffde6652dd9b2f640a5262203002d7f6cfd4f82c247@mail.kernel.org>
On 25/10/28 02:45PM, bot+bpf-ci@kernel.org wrote:
>
> ```
> commit 817a92582203a0d4c62d2de0abae0bd4a5418fa3
> Author: Anton Protopopov <a.s.protopopov@gmail.com>
>
> selftests/bpf: add new verifier_gotox test
>
> This commit adds a new BPF selftest file to validate the gotox
> (indirect jump) instruction functionality. The tests cover various
> edge cases including reserved field validation, bounds checking,
> alignment, and register usage.
>
> > diff --git a/tools/testing/selftests/bpf/prog_tests/verifier.c b/tools/testing/selftests/bpf/prog_tests/verifier.c
> > index c0e8ffdaa..4b4b081b4 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/verifier.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/verifier.c
>
> [ ... ]
>
> > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotox.c b/tools/testing/selftests/bpf/progs/verifier_gotox.c
> > new file mode 100644
> > index 000000000..f7bf0a5e0
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/verifier_gotox.c
>
> [ ... ]
>
> > +SEC("socket")
> > +__failure __msg("writes into insn_array not allowed")
> > +__naked void jump_table_no_writes(void)
> > +{
> > + asm volatile (" \
> > + .pushsection .jumptables,\"\",@progbits; \
> > +jt0_%=: \
> > + .quad ret0_%=; \
> > + .quad ret1_%=; \
> > + .size jt0_%=, 16; \
> > + .global jt0_%=; \
> > + .popsection; \
> > + \
> > + r0 = jt0_%= ll; \
> > + r0 += 8; \
> > + r1 = 0xbeef; \
> > + *(u64 *)(r0 + 0) = r1; \
>
> [ ... ]
>
> > +SEC("socket")
> > +__failure __msg("jump table for insn 4 points outside of the subprog [0,10]")
> > +__naked void jump_table_outside_subprog(void)
> > +{
> > + asm volatile (" \
> > + .pushsection .jumptables,\"\",@progbits; \
> > +jt0_%=: \
> > + .quad ret0_%=; \
> > + .quad ret1_%=; \
> > + .quad ret_out_%=; \
> > + .size jt0_%=, 24; \
> > + .global jt0_%=; \
> > + .popsection; \
> > + \
> > + r0 = jt0_%= ll; \
> > + r0 += 8; \
> > + *(u64 *)(r0 + 0) = r1; \
> > + .8byte %[gotox_r0]; \
>
> Does jump_table_outside_subprog() use the correct operation? This test
For this test it doesn't matter: the error triggered by this test happens
before the check for the writes. (But thanks AI, I will change the line
for better readability.)
> writes to the jump table (line marked with * above), but the expected
> error message indicates it should be testing bounds checking, not write
> protection. All other bounds validation tests in the file use read
> operations like "r0 = *(u64 *)(r0 + 0);" (see jump_table_misaligned_access,
> jump_table_invalid_mem_acceess_pos, jump_table_invalid_mem_acceess_neg).
> The write operation will cause the verifier to reject the program with
> "writes into insn_array not allowed" before it can validate whether the
> jump target is within the subprogram boundary.
>
> Should this be changed to a read operation to properly test the intended
> bounds check?
>
>
> ```
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> In-Reply-To-Subject: `selftests/bpf: add new verifier_gotox test`
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/18878193924
next prev parent reply other threads:[~2025-10-28 14:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 14:20 [PATCH v8 bpf-next 00/11] BPF indirect jumps Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 01/11] bpf, x86: add new map type: instructions array Anton Protopopov
2025-10-30 22:50 ` Alexei Starovoitov
2025-10-31 7:23 ` Anton Protopopov
2025-10-31 15:04 ` Alexei Starovoitov
2025-10-31 15:20 ` Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 02/11] selftests/bpf: add selftests for new insn_array map Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 03/11] bpf: support instructions arrays with constants blinding Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 04/11] selftests/bpf: test instructions arrays with blinding Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 05/11] bpf, x86: allow indirect jumps to r8...r15 Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 06/11] bpf, x86: add support for indirect jumps Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 07/11] bpf: disasm: add support for BPF_JMP|BPF_JA|BPF_X Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 08/11] libbpf: support llvm-generated indirect jumps Anton Protopopov
2025-10-29 21:31 ` Eduard Zingerman
2025-11-03 4:15 ` Yonghong Song
2025-10-30 21:00 ` Andrii Nakryiko
2025-10-31 7:30 ` Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 09/11] bpftool: Recognize insn_array map type Anton Protopopov
2025-10-28 14:20 ` [PATCH v8 bpf-next 10/11] selftests/bpf: add new verifier_gotox test Anton Protopopov
2025-10-28 14:45 ` bot+bpf-ci
2025-10-28 15:05 ` Anton Protopopov [this message]
2025-10-28 14:20 ` [PATCH v8 bpf-next 11/11] selftests/bpf: add C-level selftests for indirect jumps Anton Protopopov
2025-10-29 21:49 ` Eduard Zingerman
2025-10-30 7:46 ` 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=aQDbxmPEkOuVcQV1@mail.gmail.com \
--to=a.s.protopopov@gmail.com \
--cc=andrii@kernel.org \
--cc=aspsk@isovalent.com \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=martin.lau@kernel.org \
--cc=qmo@kernel.org \
--cc=yonghong.song@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