root/tools/testing/selftests/bpf/verifier/cfg.c

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "unreachable",
   3         .insns = {
   4         BPF_EXIT_INSN(),
   5         BPF_EXIT_INSN(),
   6         },
   7         .errstr = "unreachable",
   8         .result = REJECT,
   9 },
  10 {
  11         "unreachable2",
  12         .insns = {
  13         BPF_JMP_IMM(BPF_JA, 0, 0, 1),
  14         BPF_JMP_IMM(BPF_JA, 0, 0, 0),
  15         BPF_EXIT_INSN(),
  16         },
  17         .errstr = "unreachable",
  18         .result = REJECT,
  19 },
  20 {
  21         "out of range jump",
  22         .insns = {
  23         BPF_JMP_IMM(BPF_JA, 0, 0, 1),
  24         BPF_EXIT_INSN(),
  25         },
  26         .errstr = "jump out of range",
  27         .result = REJECT,
  28 },
  29 {
  30         "out of range jump2",
  31         .insns = {
  32         BPF_JMP_IMM(BPF_JA, 0, 0, -2),
  33         BPF_EXIT_INSN(),
  34         },
  35         .errstr = "jump out of range",
  36         .result = REJECT,
  37 },
  38 {
  39         "loop (back-edge)",
  40         .insns = {
  41         BPF_JMP_IMM(BPF_JA, 0, 0, -1),
  42         BPF_EXIT_INSN(),
  43         },
  44         .errstr = "unreachable insn 1",
  45         .errstr_unpriv = "back-edge",
  46         .result = REJECT,
  47 },
  48 {
  49         "loop2 (back-edge)",
  50         .insns = {
  51         BPF_MOV64_REG(BPF_REG_1, BPF_REG_0),
  52         BPF_MOV64_REG(BPF_REG_2, BPF_REG_0),
  53         BPF_MOV64_REG(BPF_REG_3, BPF_REG_0),
  54         BPF_JMP_IMM(BPF_JA, 0, 0, -4),
  55         BPF_EXIT_INSN(),
  56         },
  57         .errstr = "unreachable insn 4",
  58         .errstr_unpriv = "back-edge",
  59         .result = REJECT,
  60 },
  61 {
  62         "conditional loop",
  63         .insns = {
  64         BPF_MOV64_REG(BPF_REG_0, BPF_REG_1),
  65         BPF_MOV64_REG(BPF_REG_2, BPF_REG_0),
  66         BPF_MOV64_REG(BPF_REG_3, BPF_REG_0),
  67         BPF_JMP_IMM(BPF_JEQ, BPF_REG_1, 0, -3),
  68         BPF_EXIT_INSN(),
  69         },
  70         .errstr = "infinite loop detected",
  71         .errstr_unpriv = "back-edge",
  72         .result = REJECT,
  73 },

/* [<][>][^][v][top][bottom][index][help] */