summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeilin Ye <yepeilin@google.com>2025-05-07 03:43:25 +0000
committerAlexei Starovoitov <ast@kernel.org>2025-05-09 10:05:27 -0700
commit0357f29de80983992c2d3e9a5ccb4fcd03a79d76 (patch)
tree8b4a1f13c62e3b770ff1228e4dfaf8987e2e60f6
parent6e492ffcab6064cd7b317dc1f49fb9f92407aaa7 (diff)
selftests/bpf: Verify zero-extension behavior in load-acquire tests
Verify that 8-, 16- and 32-bit load-acquires are zero-extending by using immediate values with their highest bit set. Do the same for the 64-bit variant to keep the style consistent. Acked-by: Björn Töpel <bjorn@kernel.org> Reviewed-by: Pu Lehui <pulehui@huawei.com> Tested-by: Björn Töpel <bjorn@rivosinc.com> # QEMU/RVA23 Signed-off-by: Peilin Ye <yepeilin@google.com> Link: https://lore.kernel.org/r/11097fd515f10308b3941469ee4c86cb8872db3f.1746588351.git.yepeilin@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r--tools/testing/selftests/bpf/progs/verifier_load_acquire.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/verifier_load_acquire.c b/tools/testing/selftests/bpf/progs/verifier_load_acquire.c
index a696ab84bfd6..74f4f19c10b8 100644
--- a/tools/testing/selftests/bpf/progs/verifier_load_acquire.c
+++ b/tools/testing/selftests/bpf/progs/verifier_load_acquire.c
@@ -15,7 +15,7 @@ __naked void load_acquire_8(void)
{
asm volatile (
"r0 = 0;"
- "w1 = 0x12;"
+ "w1 = 0xfe;"
"*(u8 *)(r10 - 1) = w1;"
".8byte %[load_acquire_insn];" // w2 = load_acquire((u8 *)(r10 - 1));
"if r2 == r1 goto 1f;"
@@ -35,7 +35,7 @@ __naked void load_acquire_16(void)
{
asm volatile (
"r0 = 0;"
- "w1 = 0x1234;"
+ "w1 = 0xfedc;"
"*(u16 *)(r10 - 2) = w1;"
".8byte %[load_acquire_insn];" // w2 = load_acquire((u16 *)(r10 - 2));
"if r2 == r1 goto 1f;"
@@ -55,7 +55,7 @@ __naked void load_acquire_32(void)
{
asm volatile (
"r0 = 0;"
- "w1 = 0x12345678;"
+ "w1 = 0xfedcba09;"
"*(u32 *)(r10 - 4) = w1;"
".8byte %[load_acquire_insn];" // w2 = load_acquire((u32 *)(r10 - 4));
"if r2 == r1 goto 1f;"
@@ -75,7 +75,7 @@ __naked void load_acquire_64(void)
{
asm volatile (
"r0 = 0;"
- "r1 = 0x1234567890abcdef ll;"
+ "r1 = 0xfedcba0987654321 ll;"
"*(u64 *)(r10 - 8) = r1;"
".8byte %[load_acquire_insn];" // r2 = load_acquire((u64 *)(r10 - 8));
"if r2 == r1 goto 1f;"