]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
selftests/bpf: Add test for BPF_END register ID reset
authorYazhou Tang <tangyazhou518@outlook.com>
Wed, 4 Mar 2026 08:32:28 +0000 (16:32 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 10 Mar 2026 18:46:31 +0000 (11:46 -0700)
commitea1989746b77c3f63bce43af247e1de29ed6bf4a
tree415d069e0d969278640f7ad13bfd394836c569c8
parenta3125bc01884431d30d731461634c8295b6f0529
selftests/bpf: Add test for BPF_END register ID reset

Add a test case to ensure that BPF_END operations correctly break
register's scalar ID ties.

The test creates a scenario where r1 is a copy of r0, r0 undergoes a
byte swap, and then r0 is checked against a constant.

- Without the fix in the verifier, the bounds learned from r0 are
  incorrectly propagated to r1, making the verifier believe r1 is
  bounded and wrongly allowing subsequent pointer arithmetic.

- With the fix, r1 remains an unbounded scalar, and the verifier
  correctly rejects the arithmetic operation between the frame pointer
  and the unbounded register.

Co-developed-by: Tianci Cao <ziye@zju.edu.cn>
Signed-off-by: Tianci Cao <ziye@zju.edu.cn>
Co-developed-by: Shenghao Yuan <shenghaoyuan0928@163.com>
Signed-off-by: Shenghao Yuan <shenghaoyuan0928@163.com>
Signed-off-by: Yazhou Tang <tangyazhou518@outlook.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260304083228.142016-3-tangyazhou@zju.edu.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_bswap.c