BPF List
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org, ast@kernel.org,
	andrii@kernel.org, daniel@iogearbox.net, kernel-team@meta.com,
	eddyz87@gmail.com, memxor@gmail.com
Cc: yatsenko@meta.com, martin.lau@kernel.org,
	yonghong.song@linux.dev, mason@kernel.org,
	ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test JIT jumps which change at a repeated image length
Date: Thu, 22 Oct 2026 14:05:22 +0100	[thread overview]
Message-ID: <2de8122f-45de-42b1-b070-acf60ffe7c96@gmail.com> (raw)
In-Reply-To: <6896375813cf93e6e3c7ae7a8f329d9fa73568dadcb55b7ab364e5c18ce817c3@mail.kernel.org>



On 10/22/26 1:44 PM, bot+bpf-ci@kernel.org wrote:
>> selftests/bpf: Test JIT jumps which change at a repeated image length
> 
> TL;DR: Test issue: the new jit_insns subtest asserts the program was JITed, so
> it may fail instead of skipping when no JIT is available (JIT disabled or
> unsupported architecture); suggests gating on is_jit_enabled().
> 
>> diff --git a/tools/testing/selftests/bpf/prog_tests/jit_insns.c b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
>> --- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> 
> [ ... ]
> 
>> @@ -2881,6 +2881,63 @@ static void test_convergence(void)
>>  	}
>>  }
>>
>> +/*
>> + * On x86-64 a backward jump sized from its own previous-pass address grew
>> + * here while others shrank, so two passes gave the same image length with
>> + * jumps still changing. The fillers are 7 and 2 bytes of native code, the
>> + * conditional jumps are never taken.
>> + */
>> +static void test_same_len_not_converged(void)
>> +{
> 
> [ ... ]
> 
>> +	int fd;
>> +
>> +	fd = load_prog(insns, ARRAY_SIZE(insns), "same len not converged");
>> +	if (fd < 0)
>> +		return;
>> +	ASSERT_GT(jited_len(fd), 0, "same len not converged jited");
> 
> This isn't a bug, but should this assertion be skipped when no JIT is
> available?
> 

We should probably skip this entire test file if JIT is off. Out of scope
of this change though.

> jited_len() returns 0 when the program was not JITed, and test_jit_insns()
> itself is not gated on is_jit_enabled(); only serial_test_jit_insns_blinded()
> is, and it calls test__skip() when there is no JIT.
> 
> On a kernel without CONFIG_BPF_JIT_ALWAYS_ON and with
> net.core.bpf_jit_enable=0, or on an architecture without an eBPF JIT,
> __bpf_prog_select_runtime() falls back to the interpreter.  The load
> succeeds, jited_prog_len is 0, the program still runs correctly, and this
> subtest fails on ASSERT_GT(jited_len(fd), 0, ...).
> 
> Other selftests treat a missing JIT as a condition to skip or ignore, for
> example bpf_obj_id.c:
> 
> 	env.jit_enabled && !prog_infos[i].jited_prog_len
> 
> and btf_rust.c, which calls test__skip() when !info.jited_prog_len.
> 
> Would something like this keep the check for JIT-enabled setups, where it
> catches a silent fallback to the interpreter, without failing when no JIT is
> configured?
> 
> 	if (is_jit_enabled())
> 		ASSERT_GT(jited_len(fd), 0, "same len not converged jited");
> 
>> +	prog_run(fd, 1, 2, 11, "same len not converged");
>> +	close(fd);
>> +}
>> +
> 
> [ ... ]
> 
> 
> ---
> 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
> 
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/39777661721


  reply	other threads:[~2026-10-22 13:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 12:04 [PATCH bpf-next v2 0/2] bpf: Fix x86 JIT stopping before jumps converge Mykyta Yatsenko
2026-10-22 12:04 ` [PATCH bpf-next v2 1/2] bpf: Size backward jumps by the insns they jump over Mykyta Yatsenko
2026-10-22 13:18   ` Daniel Borkmann
2026-10-22 12:04 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test JIT jumps which change at a repeated image length Mykyta Yatsenko
2026-10-22 12:44   ` bot+bpf-ci
2026-10-22 13:05     ` Mykyta Yatsenko [this message]
2026-10-22 13:24       ` Daniel Borkmann
2026-10-22 13:21   ` Daniel Borkmann
2026-10-24  4:00 ` [PATCH bpf-next v2 0/2] bpf: Fix x86 JIT stopping before jumps converge 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=2de8122f-45de-42b1-b070-acf60ffe7c96@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=yatsenko@meta.com \
    --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