Skip to content

Commit c963cd4

Browse files
iii-igregkh
authored andcommitted
selftests/bpf: fix test_cgroup_storage on s390
[ Upstream commit 806ce6e ] test_cgroup_storage fails on s390 with an assertion failure: packets are dropped when they shouldn't. The problem is that BPF_DW packet count is accessed as BPF_W with an offset of 0, which is not correct on big-endian machines. Since the point of this test is not to verify narrow loads/stores, simply use BPF_DW when working with packet counts. Fixes: 68cfa3a ("selftests/bpf: add a cgroup storage test") Fixes: 919646d ("selftests/bpf: extend the storage test to test per-cpu cgroup storage") Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f4a9b28 commit c963cd4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎tools/testing/selftests/bpf/test_cgroup_storage.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ int main(int argc, char **argv)
2020
BPF_MOV64_IMM(BPF_REG_2, 0), /* flags, not used */
2121
BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
2222
BPF_FUNC_get_local_storage),
23-
BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_0, 0),
23+
BPF_LDX_MEM(BPF_DW, BPF_REG_3, BPF_REG_0, 0),
2424
BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 0x1),
25-
BPF_STX_MEM(BPF_W, BPF_REG_0, BPF_REG_3, 0),
25+
BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_3, 0),
2626

2727
BPF_LD_MAP_FD(BPF_REG_1, 0), /* map fd */
2828
BPF_MOV64_IMM(BPF_REG_2, 0), /* flags, not used */
2929
BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
3030
BPF_FUNC_get_local_storage),
3131
BPF_MOV64_IMM(BPF_REG_1, 1),
3232
BPF_STX_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0),
33-
BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, 0),
33+
BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, 0),
3434
BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x1),
3535
BPF_MOV64_REG(BPF_REG_0, BPF_REG_1),
3636
BPF_EXIT_INSN(),

0 commit comments

Comments
 (0)