[PATCH bpf-next 0/2] bpf, x86: Normalize IA32 kfunc return values

Yiyang Chen <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <20260813-bpf-next-039-ia32-kfunc-return-v1-v1-0-37495ec632b5@mails.tsinghua.edu.cn>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.