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

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "bpf_exit with invalid return code. test1",
   3         .insns = {
   4         BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),
   5         BPF_EXIT_INSN(),
   6         },
   7         .errstr = "R0 has value (0x0; 0xffffffff)",
   8         .result = REJECT,
   9         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  10 },
  11 {
  12         "bpf_exit with invalid return code. test2",
  13         .insns = {
  14         BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),
  15         BPF_ALU64_IMM(BPF_AND, BPF_REG_0, 1),
  16         BPF_EXIT_INSN(),
  17         },
  18         .result = ACCEPT,
  19         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  20 },
  21 {
  22         "bpf_exit with invalid return code. test3",
  23         .insns = {
  24         BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),
  25         BPF_ALU64_IMM(BPF_AND, BPF_REG_0, 3),
  26         BPF_EXIT_INSN(),
  27         },
  28         .errstr = "R0 has value (0x0; 0x3)",
  29         .result = REJECT,
  30         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  31 },
  32 {
  33         "bpf_exit with invalid return code. test4",
  34         .insns = {
  35         BPF_MOV64_IMM(BPF_REG_0, 1),
  36         BPF_EXIT_INSN(),
  37         },
  38         .result = ACCEPT,
  39         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  40 },
  41 {
  42         "bpf_exit with invalid return code. test5",
  43         .insns = {
  44         BPF_MOV64_IMM(BPF_REG_0, 2),
  45         BPF_EXIT_INSN(),
  46         },
  47         .errstr = "R0 has value (0x2; 0x0)",
  48         .result = REJECT,
  49         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  50 },
  51 {
  52         "bpf_exit with invalid return code. test6",
  53         .insns = {
  54         BPF_MOV64_REG(BPF_REG_0, BPF_REG_1),
  55         BPF_EXIT_INSN(),
  56         },
  57         .errstr = "R0 is not a known value (ctx)",
  58         .result = REJECT,
  59         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  60 },
  61 {
  62         "bpf_exit with invalid return code. test7",
  63         .insns = {
  64         BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1, 0),
  65         BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, 4),
  66         BPF_ALU64_REG(BPF_MUL, BPF_REG_0, BPF_REG_2),
  67         BPF_EXIT_INSN(),
  68         },
  69         .errstr = "R0 has unknown scalar value",
  70         .result = REJECT,
  71         .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
  72 },

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