• Christophe Leroy's avatar
    powerpc/bpf/32: Fix failing test_bpf tests · 8ecf3c1d
    Christophe Leroy authored
    Recent additions in BPF like cpu v4 instructions, test_bpf module
    exhibits the following failures:
    
      test_bpf: #82 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
      test_bpf: #83 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
      test_bpf: #84 ALU64_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
      test_bpf: #85 ALU64_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
      test_bpf: #86 ALU64_MOVSX | BPF_W jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
    
      test_bpf: #165 ALU_SDIV_X: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
      test_bpf: #166 ALU_SDIV_K: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
    
      test_bpf: #169 ALU_SMOD_X: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
      test_bpf: #170 ALU_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
    
      test_bpf: #172 ALU64_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
    
      test_bpf: #313 BSWAP 16: 0x0123456789abcdef -> 0xefcd
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 301 PASS
      test_bpf: #314 BSWAP 32: 0x0123456789abcdef -> 0xefcdab89
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 555 PASS
      test_bpf: #315 BSWAP 64: 0x0123456789abcdef -> 0x67452301
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 268 PASS
      test_bpf: #316 BSWAP 64: 0x0123456789abcdef >> 32 -> 0xefcdab89
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 269 PASS
      test_bpf: #317 BSWAP 16: 0xfedcba9876543210 -> 0x1032
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 460 PASS
      test_bpf: #318 BSWAP 32: 0xfedcba9876543210 -> 0x10325476
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 320 PASS
      test_bpf: #319 BSWAP 64: 0xfedcba9876543210 -> 0x98badcfe
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 222 PASS
      test_bpf: #320 BSWAP 64: 0xfedcba9876543210 >> 32 -> 0x10325476
      eBPF filter opcode 00d7 (@2) unsupported
      jited:0 273 PASS
    
      test_bpf: #344 BPF_LDX_MEMSX | BPF_B
      eBPF filter opcode 0091 (@5) unsupported
      jited:0 432 PASS
      test_bpf: #345 BPF_LDX_MEMSX | BPF_H
      eBPF filter opcode 0089 (@5) unsupported
      jited:0 381 PASS
      test_bpf: #346 BPF_LDX_MEMSX | BPF_W
      eBPF filter opcode 0081 (@5) unsupported
      jited:0 505 PASS
    
      test_bpf: #490 JMP32_JA: Unconditional jump: if (true) return 1
      eBPF filter opcode 0006 (@1) unsupported
      jited:0 261 PASS
    
      test_bpf: Summary: 1040 PASSED, 10 FAILED, [924/1038 JIT'ed]
    
    Fix them by adding missing processing.
    
    Fixes: daabb2b0 ("bpf/tests: add tests for cpuv4 instructions")
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/91de862dda99d170697eb79ffb478678af7e0b27.1709652689.git.christophe.leroy@csgroup.eu
    8ecf3c1d
bpf_jit_comp32.c 42 KB