b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | { |
| 2 | "read uninitialized register", |
| 3 | .insns = { |
| 4 | BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), |
| 5 | BPF_EXIT_INSN(), |
| 6 | }, |
| 7 | .errstr = "R2 !read_ok", |
| 8 | .result = REJECT, |
| 9 | }, |
| 10 | { |
| 11 | "read invalid register", |
| 12 | .insns = { |
| 13 | BPF_MOV64_REG(BPF_REG_0, -1), |
| 14 | BPF_EXIT_INSN(), |
| 15 | }, |
| 16 | .errstr = "R15 is invalid", |
| 17 | .result = REJECT, |
| 18 | }, |
| 19 | { |
| 20 | "program doesn't init R0 before exit", |
| 21 | .insns = { |
| 22 | BPF_ALU64_REG(BPF_MOV, BPF_REG_2, BPF_REG_1), |
| 23 | BPF_EXIT_INSN(), |
| 24 | }, |
| 25 | .errstr = "R0 !read_ok", |
| 26 | .result = REJECT, |
| 27 | }, |
| 28 | { |
| 29 | "program doesn't init R0 before exit in all branches", |
| 30 | .insns = { |
| 31 | BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), |
| 32 | BPF_MOV64_IMM(BPF_REG_0, 1), |
| 33 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 2), |
| 34 | BPF_EXIT_INSN(), |
| 35 | }, |
| 36 | .errstr = "R0 !read_ok", |
| 37 | .errstr_unpriv = "R1 pointer comparison", |
| 38 | .result = REJECT, |
| 39 | }, |