* [PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390
@ 2019-07-16 10:53 Ilya Leoshkevich
2019-07-16 16:23 ` Alexei Starovoitov
0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2019-07-16 10:53 UTC (permalink / raw)
To: bpf, netdev
Cc: gor, heiko.carstens, alexei.starovoitov, daniel, ys114321,
Ilya Leoshkevich
BPF_LDX_MEM is used to load the least significant byte of the retrieved
test_val.index, however, on big-endian machines it ends up retrieving
the most significant byte.
Change the test to load the whole int in order to make it
endianness-independent.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
v1->v2:
- use __BYTE_ORDER instead of __BYTE_ORDER__.
v2->v3:
- load the whole int instead of byte.
tools/testing/selftests/bpf/verifier/value_ptr_arith.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
index c3de1a2c9dc5..a53d99cebd9f 100644
--- a/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
+++ b/tools/testing/selftests/bpf/verifier/value_ptr_arith.c
@@ -183,7 +183,7 @@
BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1),
BPF_EXIT_INSN(),
- BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
+ BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, 0),
BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, 3),
BPF_MOV64_IMM(BPF_REG_2, 0),
BPF_MOV64_IMM(BPF_REG_3, 0x100000),
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390
2019-07-16 10:53 [PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390 Ilya Leoshkevich
@ 2019-07-16 16:23 ` Alexei Starovoitov
0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2019-07-16 16:23 UTC (permalink / raw)
To: Ilya Leoshkevich; +Cc: bpf, netdev, gor, heiko.carstens, daniel, ys114321
On Tue, Jul 16, 2019 at 12:53:53PM +0200, Ilya Leoshkevich wrote:
> BPF_LDX_MEM is used to load the least significant byte of the retrieved
> test_val.index, however, on big-endian machines it ends up retrieving
> the most significant byte.
>
> Change the test to load the whole int in order to make it
> endianness-independent.
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Applied, Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-16 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-16 10:53 [PATCH bpf v3] selftests/bpf: fix "alu with different scalars 1" on s390 Ilya Leoshkevich
2019-07-16 16:23 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).