17960d02dSBrendan Jackman #define __INVALID_ATOMIC_ACCESS_TEST(op) \ 27960d02dSBrendan Jackman { \ 37960d02dSBrendan Jackman "atomic " #op " access through non-pointer ", \ 47960d02dSBrendan Jackman .insns = { \ 57960d02dSBrendan Jackman BPF_MOV64_IMM(BPF_REG_0, 1), \ 67960d02dSBrendan Jackman BPF_MOV64_IMM(BPF_REG_1, 0), \ 77960d02dSBrendan Jackman BPF_ATOMIC_OP(BPF_DW, op, BPF_REG_1, BPF_REG_0, -8), \ 87960d02dSBrendan Jackman BPF_MOV64_IMM(BPF_REG_0, 0), \ 97960d02dSBrendan Jackman BPF_EXIT_INSN(), \ 107960d02dSBrendan Jackman }, \ 117960d02dSBrendan Jackman .result = REJECT, \ 12*7df5072cSMykola Lysenko .errstr = "R1 invalid mem access 'scalar'" \ 137960d02dSBrendan Jackman } 147960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD), 157960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD | BPF_FETCH), 167960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD), 177960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD | BPF_FETCH), 187960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_AND), 197960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_AND | BPF_FETCH), 207960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_OR), 217960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_OR | BPF_FETCH), 227960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_XOR), 237960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_XOR | BPF_FETCH), 247960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_XCHG), 257960d02dSBrendan Jackman __INVALID_ATOMIC_ACCESS_TEST(BPF_CMPXCHG), 26