atomic_invalid.c (941B)
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),