Skip to content

Commit 6ef790a

Browse files
peilin-yeKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
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. Signed-off-by: Peilin Ye <[email protected]>
1 parent a6b9e08 commit 6ef790a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/testing/selftests/bpf/progs/verifier_load_acquire.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ __naked void load_acquire_8(void)
1515
{
1616
asm volatile (
1717
"r0 = 0;"
18-
"w1 = 0x12;"
18+
"w1 = 0xfe;"
1919
"*(u8 *)(r10 - 1) = w1;"
2020
".8byte %[load_acquire_insn];" // w2 = load_acquire((u8 *)(r10 - 1));
2121
"if r2 == r1 goto 1f;"
@@ -35,7 +35,7 @@ __naked void load_acquire_16(void)
3535
{
3636
asm volatile (
3737
"r0 = 0;"
38-
"w1 = 0x1234;"
38+
"w1 = 0xfedc;"
3939
"*(u16 *)(r10 - 2) = w1;"
4040
".8byte %[load_acquire_insn];" // w2 = load_acquire((u16 *)(r10 - 2));
4141
"if r2 == r1 goto 1f;"
@@ -55,7 +55,7 @@ __naked void load_acquire_32(void)
5555
{
5656
asm volatile (
5757
"r0 = 0;"
58-
"w1 = 0x12345678;"
58+
"w1 = 0xfedcba09;"
5959
"*(u32 *)(r10 - 4) = w1;"
6060
".8byte %[load_acquire_insn];" // w2 = load_acquire((u32 *)(r10 - 4));
6161
"if r2 == r1 goto 1f;"
@@ -75,7 +75,7 @@ __naked void load_acquire_64(void)
7575
{
7676
asm volatile (
7777
"r0 = 0;"
78-
"r1 = 0x1234567890abcdef ll;"
78+
"r1 = 0xfedcba0987654321 ll;"
7979
"*(u64 *)(r10 - 8) = r1;"
8080
".8byte %[load_acquire_insn];" // r2 = load_acquire((u64 *)(r10 - 8));
8181
"if r2 == r1 goto 1f;"

0 commit comments

Comments
 (0)