Skip to contentSkip to conversation

selftests/bpf: fix "valid read map access into a read-only array 1" on s390

PATCH Applied Ilya Leoshkevich 2 participants 2 messages Jul 18, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: fix "valid read map access into a read-only array 1" on s390

This test looks up a 32-bit map element and then loads it using a 64-bit load. This does not work on s390, which is a big-endian machine.

Since the point of this test doesn't seem to be loading a smaller value using a larger load, simply use a 32-bit load.

---
 tools/testing/selftests/bpf/verifier/array_access.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/verifier/array_access.c +1 -1
index bcb83196e459..f3c33e128709 100644
@@ -226,7 +226,7 @@
 	BPF_LD_MAP_FD(BPF_REG_1, 0),
 	BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
 	BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
-	BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
+	BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, 0),
 	BPF_EXIT_INSN(),
 	},
 	.fixup_map_array_ro = { 3 },
Signature · 1 line
2.21.0
#1 lore raw
Quoted 8 lines · Ilya Leoshkevich

This test looks up a 32-bit map element and then loads it using a 64-bit load. This does not work on s390, which is a big-endian machine.

Since the point of this test doesn't seem to be loading a smaller value using a larger load, simply use a 32-bit load.

Applied. Thanks