selftests/bpf: Give the first loop of cond_break5 an end

The main prog of cond_break5 spins until may_goto stops the loop. Then it
calls a subprog and expects that the loop of the subprog makes iterations.
This is true only while each stack frame has a time slice of its own.

Stop the first loop after 100 iterations. The test still makes sure that
may_goto works in the main prog and in a subprog of one prog.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261031215543.682284-4-alexei.starovoitov@gmail.com
This commit is contained in:
Alexei Starovoitov 2026-10-31 21:55:37 +00:00
parent fcda8096dc
commit 40a3a2e686
No known key found for this signature in database

View File

@ -553,7 +553,11 @@ int cond_break5(const void *ctx)
{
int cnt1 = zero, cnt2;
for (;;) {
/*
* There is one time slice for all may_goto of the prog. When it's used up a function that
* is called after that makes no iteration. So this loop has an end.
*/
for (; cnt1 < 100;) {
cond_break;
cnt1++;
}