treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / bpf / verifier / direct_stack_access_wraparound.c
blob698e3779fdd2a0f65ee161f83fd0568f40929eda
2 "direct stack access with 32-bit wraparound. test1",
3 .insns = {
4 BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
5 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x7fffffff),
6 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x7fffffff),
7 BPF_MOV32_IMM(BPF_REG_0, 0),
8 BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
9 BPF_EXIT_INSN(),
11 .errstr = "fp pointer and 2147483647",
12 .result = REJECT
15 "direct stack access with 32-bit wraparound. test2",
16 .insns = {
17 BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
18 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x3fffffff),
19 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x3fffffff),
20 BPF_MOV32_IMM(BPF_REG_0, 0),
21 BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
22 BPF_EXIT_INSN(),
24 .errstr = "fp pointer and 1073741823",
25 .result = REJECT
28 "direct stack access with 32-bit wraparound. test3",
29 .insns = {
30 BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
31 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x1fffffff),
32 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x1fffffff),
33 BPF_MOV32_IMM(BPF_REG_0, 0),
34 BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
35 BPF_EXIT_INSN(),
37 .errstr = "fp pointer offset 1073741822",
38 .errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
39 .result = REJECT