Skip to content

Port selftests for loop (non-volatile) which are feasible now - #109

Merged
r41k0u merged 3 commits into
masterfrom
tests/loop-selftests
Oct 8, 2026
Merged

r41k0u merged 3 commits into
masterfrom
tests/loop-selftests

Conversation

@r41k0u

@r41k0u r41k0u commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

r41k0u and others added 2 commits October 9, 2026 01:54
for/while lower since #106. The iterator loops (bpf_for, bpf_repeat) and the
bpf_loop helper do not, so they keep a hard label of their own, and a
do { } while (0) macro is no longer read as a loop. Against bpf-next 5714ca8
the programs with no hard blocker go from 29 to 39.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Four programs from prog_tests/bpf_verif_scale.c that loops alone kept out.
The loop lowering matches clang's for the same C, but volatile, barrier()
and the no-unroll pragma have no spelling here: loop2 folds to a constant
and loop4 unrolls, so those two no longer make the verifier walk a loop.
Their headers and PORTING-NOTES.md say so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The added fixtures and audit updates are internally consistent, with known semantic limitations clearly documented.

0 open findings

What changed in this PR

Ports four Linux BPF loop selftests and updates audit documentation for newly supported loops.

Changes:

  • Adds nested, bounded, and break-driven loop fixtures.
  • Updates selftest auditing to distinguish unsupported iterator/helper loops.
  • Documents port limitations caused by missing volatile reads and compiler barriers.
File Description
tools/​selftest-audit.py Updates loop classification.
tests/​kernel_selftest_equivalent/​vmlinux/​loop1.py Adds nested-loop verifier test.
tests/​kernel_selftest_equivalent/​vmlinux/​loop2.py Adds break-driven while-loop port.
tests/​kernel_selftest_equivalent/​vmlinux/​loop4.py Adds bounded branching-loop port.
tests/​kernel_selftest_equivalent/​vmlinux/​loop5.py Adds multi-exit while-loop port.
tests/​kernel_selftest_equivalent/​PORTING-NOTES.md Records coverage and limitations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@r41k0u r41k0u changed the title Port selftests for loop (non-volatil) which are feasible now Port selftests for loop (non-volatile) which are feasible now Oct 8, 2026
…operly

-d asks the kernel for the instruction-level verifier log on every load. For
loop1, which makes the verifier walk nested loops, that log outgrows libbpf's
buffer; the kernel fails the load with ENOSPC, libbpf doubles the buffer and
verifies again, and on CI the load ran past the 30s timeout. A rejection
still comes with its log without -d, since libbpf retries a failed load at
log level 1 and prints it as a warning.

The timeout path also returned a bare string where callers expect stdout and
stderr, so a timeout surfaced as an AttributeError instead of the timeout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@r41k0u

r41k0u commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

lgtm, simple change.

@r41k0u
r41k0u merged commit de259c8 into master Oct 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants