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

/* [<][>][^][v][top][bottom][index][help] */
   1 {
   2         "direct stack access with 32-bit wraparound. test1",
   3         .insns = {
   4         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
   5         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x7fffffff),
   6         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x7fffffff),
   7         BPF_MOV32_IMM(BPF_REG_0, 0),
   8         BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
   9         BPF_EXIT_INSN(),
  10         },
  11         .errstr = "fp pointer and 2147483647",
  12         .result = REJECT
  13 },
  14 {
  15         "direct stack access with 32-bit wraparound. test2",
  16         .insns = {
  17         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
  18         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x3fffffff),
  19         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x3fffffff),
  20         BPF_MOV32_IMM(BPF_REG_0, 0),
  21         BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
  22         BPF_EXIT_INSN(),
  23         },
  24         .errstr = "fp pointer and 1073741823",
  25         .result = REJECT
  26 },
  27 {
  28         "direct stack access with 32-bit wraparound. test3",
  29         .insns = {
  30         BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
  31         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x1fffffff),
  32         BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0x1fffffff),
  33         BPF_MOV32_IMM(BPF_REG_0, 0),
  34         BPF_STX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
  35         BPF_EXIT_INSN(),
  36         },
  37         .errstr = "fp pointer offset 1073741822",
  38         .errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
  39         .result = REJECT
  40 },

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