diff options
| author | Puranjay Mohan <puranjay@kernel.org> | 2026-08-04 06:45:54 -0700 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-08-05 10:44:35 -0700 |
| commit | f8f2b567d56035ddd62ec82f2c35dcee8c516624 (patch) | |
| tree | 51abe779915daa6cadf9dd1a642736f12acee303 /tools/perf/scripts/python/syscall-counts.py | |
| parent | 8efd87051c3a2a054519955ca401229f4e84b310 (diff) | |
bpf: Inline bpf_iter_num_new() kfunc
bpf_for() expands to the bpf_iter_num_{new,next,destroy}() kfuncs, which
the verifier emits as regular calls. They are tiny and only touch the
8-byte on-stack iterator state, so open-code them in bpf_fixup_kfunc_call()
like the other special kfuncs there.
Start with bpf_iter_num_new(): R1 points to the iterator, R2/R3 hold
start/end. The inlined sequence mirrors the kfunc and returns the same
-EINVAL / -E2BIG / 0.
start > end is rejected first, so end - start fits in a u32; range-check
it as u32 on both sides ((u32)(end - start) in the kfunc). A movsx-based
check would emit a cpuv4 instruction that some JITs (x86-32, mips32,
sparc64) decode as a plain move and get wrong.
The emitted instructions are plain BPF, so the interpreter path stays
correct and no jit_required marking is needed.
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260804134601.2305303-3-puranjay@kernel.org
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions
