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

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "runtime/jit: tail_call within bounds, prog once",
   3         .insns = {
   4         BPF_MOV64_IMM(BPF_REG_3, 0),
   5         BPF_LD_MAP_FD(BPF_REG_2, 0),
   6         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
   7         BPF_MOV64_IMM(BPF_REG_0, 1),
   8         BPF_EXIT_INSN(),
   9         },
  10         .fixup_prog1 = { 1 },
  11         .result = ACCEPT,
  12         .retval = 42,
  13 },
  14 {
  15         "runtime/jit: tail_call within bounds, prog loop",
  16         .insns = {
  17         BPF_MOV64_IMM(BPF_REG_3, 1),
  18         BPF_LD_MAP_FD(BPF_REG_2, 0),
  19         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
  20         BPF_MOV64_IMM(BPF_REG_0, 1),
  21         BPF_EXIT_INSN(),
  22         },
  23         .fixup_prog1 = { 1 },
  24         .result = ACCEPT,
  25         .retval = 41,
  26 },
  27 {
  28         "runtime/jit: tail_call within bounds, no prog",
  29         .insns = {
  30         BPF_MOV64_IMM(BPF_REG_3, 2),
  31         BPF_LD_MAP_FD(BPF_REG_2, 0),
  32         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
  33         BPF_MOV64_IMM(BPF_REG_0, 1),
  34         BPF_EXIT_INSN(),
  35         },
  36         .fixup_prog1 = { 1 },
  37         .result = ACCEPT,
  38         .retval = 1,
  39 },
  40 {
  41         "runtime/jit: tail_call out of bounds",
  42         .insns = {
  43         BPF_MOV64_IMM(BPF_REG_3, 256),
  44         BPF_LD_MAP_FD(BPF_REG_2, 0),
  45         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
  46         BPF_MOV64_IMM(BPF_REG_0, 2),
  47         BPF_EXIT_INSN(),
  48         },
  49         .fixup_prog1 = { 1 },
  50         .result = ACCEPT,
  51         .retval = 2,
  52 },
  53 {
  54         "runtime/jit: pass negative index to tail_call",
  55         .insns = {
  56         BPF_MOV64_IMM(BPF_REG_3, -1),
  57         BPF_LD_MAP_FD(BPF_REG_2, 0),
  58         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
  59         BPF_MOV64_IMM(BPF_REG_0, 2),
  60         BPF_EXIT_INSN(),
  61         },
  62         .fixup_prog1 = { 1 },
  63         .result = ACCEPT,
  64         .retval = 2,
  65 },
  66 {
  67         "runtime/jit: pass > 32bit index to tail_call",
  68         .insns = {
  69         BPF_LD_IMM64(BPF_REG_3, 0x100000000ULL),
  70         BPF_LD_MAP_FD(BPF_REG_2, 0),
  71         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call),
  72         BPF_MOV64_IMM(BPF_REG_0, 2),
  73         BPF_EXIT_INSN(),
  74         },
  75         .fixup_prog1 = { 2 },
  76         .result = ACCEPT,
  77         .retval = 42,
  78         /* Verifier rewrite for unpriv skips tail call here. */
  79         .retval_unpriv = 2,
  80 },

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