The IA32 JIT stores BPF registers as pairs of 32-bit scratch words. Kfunc returns narrower than 64 bits currently update only R0.low32, so full-width uses can observe a stale R0.high32 value.
Patch 1 uses the BTF function model to sign- or zero-extend narrow returns into EDX:EAX and stores both halves of R0. Patch 2 adds IA32-specific test_loader support and unsigned bool and signed int kfunc return regression tests. Yiyang Chen (2): bpf, x86: Normalize narrow kfunc returns on IA32 selftests/bpf: Cover IA32 narrow kfunc returns Signed-off-by: Yiyang Chen <[email protected]> --- Yiyang Chen (2): bpf, x86: Normalize narrow kfunc returns on IA32 selftests/bpf: Cover IA32 narrow kfunc returns arch/x86/net/bpf_jit_comp32.c | 53 +++++++++++--- tools/testing/selftests/bpf/prog_tests/verifier.c | 2 + tools/testing/selftests/bpf/progs/bpf_misc.h | 1 + .../selftests/bpf/progs/verifier_kfunc_return.c | 84 ++++++++++++++++++++++ tools/testing/selftests/bpf/test_loader.c | 13 ++-- 5 files changed, 140 insertions(+), 13 deletions(-) --- base-commit: 6f033615ef8fb2374daa7e50a8ff68616bc850d2 -- 2.43.0

