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

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "constant register |= constant should keep constant type",
   3         .insns = {
   4         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
   5         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -48),
   6         BPF_MOV64_IMM(BPF_REG_2, 34),
   7         BPF_ALU64_IMM(BPF_OR, BPF_REG_2, 13),
   8         BPF_MOV64_IMM(BPF_REG_3, 0),
   9         BPF_EMIT_CALL(BPF_FUNC_probe_read),
  10         BPF_EXIT_INSN(),
  11         },
  12         .result = ACCEPT,
  13         .prog_type = BPF_PROG_TYPE_TRACEPOINT,
  14 },
  15 {
  16         "constant register |= constant should not bypass stack boundary checks",
  17         .insns = {
  18         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
  19         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -48),
  20         BPF_MOV64_IMM(BPF_REG_2, 34),
  21         BPF_ALU64_IMM(BPF_OR, BPF_REG_2, 24),
  22         BPF_MOV64_IMM(BPF_REG_3, 0),
  23         BPF_EMIT_CALL(BPF_FUNC_probe_read),
  24         BPF_EXIT_INSN(),
  25         },
  26         .errstr = "invalid stack type R1 off=-48 access_size=58",
  27         .result = REJECT,
  28         .prog_type = BPF_PROG_TYPE_TRACEPOINT,
  29 },
  30 {
  31         "constant register |= constant register should keep constant type",
  32         .insns = {
  33         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
  34         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -48),
  35         BPF_MOV64_IMM(BPF_REG_2, 34),
  36         BPF_MOV64_IMM(BPF_REG_4, 13),
  37         BPF_ALU64_REG(BPF_OR, BPF_REG_2, BPF_REG_4),
  38         BPF_MOV64_IMM(BPF_REG_3, 0),
  39         BPF_EMIT_CALL(BPF_FUNC_probe_read),
  40         BPF_EXIT_INSN(),
  41         },
  42         .result = ACCEPT,
  43         .prog_type = BPF_PROG_TYPE_TRACEPOINT,
  44 },
  45 {
  46         "constant register |= constant register should not bypass stack boundary checks",
  47         .insns = {
  48         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
  49         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -48),
  50         BPF_MOV64_IMM(BPF_REG_2, 34),
  51         BPF_MOV64_IMM(BPF_REG_4, 24),
  52         BPF_ALU64_REG(BPF_OR, BPF_REG_2, BPF_REG_4),
  53         BPF_MOV64_IMM(BPF_REG_3, 0),
  54         BPF_EMIT_CALL(BPF_FUNC_probe_read),
  55         BPF_EXIT_INSN(),
  56         },
  57         .errstr = "invalid stack type R1 off=-48 access_size=58",
  58         .result = REJECT,
  59         .prog_type = BPF_PROG_TYPE_TRACEPOINT,
  60 },

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