1 #define __INVALID_ATOMIC_ACCESS_TEST(op) \ 2 { \ 3 "atomic " #op " access through non-pointer ", \ 4 .insns = { \ 5 BPF_MOV64_IMM(BPF_REG_0, 1), \ 6 BPF_MOV64_IMM(BPF_REG_1, 0), \ 7 BPF_ATOMIC_OP(BPF_DW, op, BPF_REG_1, BPF_REG_0, -8), \ 8 BPF_MOV64_IMM(BPF_REG_0, 0), \ 9 BPF_EXIT_INSN(), \ 10 }, \ 11 .result = REJECT, \ 12 .errstr = "R1 invalid mem access 'scalar'" \ 13 } 14 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD), 15 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD | BPF_FETCH), 16 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD), 17 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD | BPF_FETCH), 18 __INVALID_ATOMIC_ACCESS_TEST(BPF_AND), 19 __INVALID_ATOMIC_ACCESS_TEST(BPF_AND | BPF_FETCH), 20 __INVALID_ATOMIC_ACCESS_TEST(BPF_OR), 21 __INVALID_ATOMIC_ACCESS_TEST(BPF_OR | BPF_FETCH), 22 __INVALID_ATOMIC_ACCESS_TEST(BPF_XOR), 23 __INVALID_ATOMIC_ACCESS_TEST(BPF_XOR | BPF_FETCH), 24 __INVALID_ATOMIC_ACCESS_TEST(BPF_XCHG), 25 __INVALID_ATOMIC_ACCESS_TEST(BPF_CMPXCHG), 26