| From a21b993215929b5410359ff7f36b56862311af48 Mon Sep 17 00:00:00 2001 |
| From: Ilya Leoshkevich <iii@linux.ibm.com> |
| Date: Fri, 30 Aug 2019 13:07:30 +0200 |
| Subject: [PATCH] selftests/bpf: fix "ctx:write sysctl:write read ok" on s390 |
| |
| commit 3404ddf234ba4677bf224cb15ddcdea0ceab956e upstream. |
| |
| "ctx:write sysctl:write read ok" fails on s390 because it reads the |
| first byte of an int assuming it's the least-significant one, which |
| is not the case on big-endian arches. Since we are not testing narrow |
| accesses here (there is e.g. "ctx:file_pos sysctl:read read ok narrow" |
| for that), simply read the whole int. |
| |
| Fixes: 1f5fa9ab6e2e ("selftests/bpf: Test BPF_CGROUP_SYSCTL") |
| Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> |
| Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/tools/testing/selftests/bpf/test_sysctl.c b/tools/testing/selftests/bpf/test_sysctl.c |
| index c938f1767ca7..6290da6aaaca 100644 |
| --- a/tools/testing/selftests/bpf/test_sysctl.c |
| +++ b/tools/testing/selftests/bpf/test_sysctl.c |
| @@ -100,7 +100,7 @@ static struct sysctl_test tests[] = { |
| .descr = "ctx:write sysctl:write read ok", |
| .insns = { |
| /* If (write) */ |
| - BPF_LDX_MEM(BPF_B, BPF_REG_7, BPF_REG_1, |
| + BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_1, |
| offsetof(struct bpf_sysctl, write)), |
| BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 1, 2), |
| |
| -- |
| 2.27.0 |
| |