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

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "invalid call insn1",
   3         .insns = {
   4         BPF_RAW_INSN(BPF_JMP | BPF_CALL | BPF_X, 0, 0, 0, 0),
   5         BPF_EXIT_INSN(),
   6         },
   7         .errstr = "unknown opcode 8d",
   8         .result = REJECT,
   9 },
  10 {
  11         "invalid call insn2",
  12         .insns = {
  13         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 1, 0),
  14         BPF_EXIT_INSN(),
  15         },
  16         .errstr = "BPF_CALL uses reserved",
  17         .result = REJECT,
  18 },
  19 {
  20         "invalid function call",
  21         .insns = {
  22         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, 1234567),
  23         BPF_EXIT_INSN(),
  24         },
  25         .errstr = "invalid func unknown#1234567",
  26         .result = REJECT,
  27 },
  28 {
  29         "invalid argument register",
  30         .insns = {
  31         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_cgroup_classid),
  32         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_cgroup_classid),
  33         BPF_EXIT_INSN(),
  34         },
  35         .errstr = "R1 !read_ok",
  36         .result = REJECT,
  37         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
  38 },
  39 {
  40         "non-invalid argument register",
  41         .insns = {
  42         BPF_ALU64_REG(BPF_MOV, BPF_REG_6, BPF_REG_1),
  43         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_cgroup_classid),
  44         BPF_ALU64_REG(BPF_MOV, BPF_REG_1, BPF_REG_6),
  45         BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_cgroup_classid),
  46         BPF_EXIT_INSN(),
  47         },
  48         .result = ACCEPT,
  49         .prog_type = BPF_PROG_TYPE_SCHED_CLS,
  50 },

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