2 "check deducing bounds from const, 1",
4 BPF_MOV64_IMM(BPF_REG_0
, 1),
5 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 1, 0),
6 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
10 .errstr
= "R0 tried to subtract pointer from scalar",
13 "check deducing bounds from const, 2",
15 BPF_MOV64_IMM(BPF_REG_0
, 1),
16 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 1, 1),
18 BPF_JMP_IMM(BPF_JSLE
, BPF_REG_0
, 1, 1),
20 BPF_ALU64_REG(BPF_SUB
, BPF_REG_1
, BPF_REG_0
),
27 "check deducing bounds from const, 3",
29 BPF_MOV64_IMM(BPF_REG_0
, 0),
30 BPF_JMP_IMM(BPF_JSLE
, BPF_REG_0
, 0, 0),
31 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
35 .errstr
= "R0 tried to subtract pointer from scalar",
38 "check deducing bounds from const, 4",
40 BPF_MOV64_IMM(BPF_REG_0
, 0),
41 BPF_JMP_IMM(BPF_JSLE
, BPF_REG_0
, 0, 1),
43 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 0, 1),
45 BPF_ALU64_REG(BPF_SUB
, BPF_REG_1
, BPF_REG_0
),
51 "check deducing bounds from const, 5",
53 BPF_MOV64_IMM(BPF_REG_0
, 0),
54 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 1, 1),
55 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
59 .errstr
= "R0 tried to subtract pointer from scalar",
62 "check deducing bounds from const, 6",
64 BPF_MOV64_IMM(BPF_REG_0
, 0),
65 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 0, 1),
67 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
71 .errstr
= "R0 tried to subtract pointer from scalar",
74 "check deducing bounds from const, 7",
76 BPF_MOV64_IMM(BPF_REG_0
, ~0),
77 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 0, 0),
78 BPF_ALU64_REG(BPF_SUB
, BPF_REG_1
, BPF_REG_0
),
79 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
80 offsetof(struct __sk_buff
, mark
)),
84 .errstr
= "dereference of modified ctx ptr",
85 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
88 "check deducing bounds from const, 8",
90 BPF_MOV64_IMM(BPF_REG_0
, ~0),
91 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 0, 1),
92 BPF_ALU64_REG(BPF_ADD
, BPF_REG_1
, BPF_REG_0
),
93 BPF_LDX_MEM(BPF_W
, BPF_REG_0
, BPF_REG_1
,
94 offsetof(struct __sk_buff
, mark
)),
98 .errstr
= "dereference of modified ctx ptr",
99 .flags
= F_NEEDS_EFFICIENT_UNALIGNED_ACCESS
,
102 "check deducing bounds from const, 9",
104 BPF_MOV64_IMM(BPF_REG_0
, 0),
105 BPF_JMP_IMM(BPF_JSGE
, BPF_REG_0
, 0, 0),
106 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
110 .errstr
= "R0 tried to subtract pointer from scalar",
113 "check deducing bounds from const, 10",
115 BPF_MOV64_IMM(BPF_REG_0
, 0),
116 BPF_JMP_IMM(BPF_JSLE
, BPF_REG_0
, 0, 0),
117 /* Marks reg as unknown. */
118 BPF_ALU64_IMM(BPF_NEG
, BPF_REG_0
, 0),
119 BPF_ALU64_REG(BPF_SUB
, BPF_REG_0
, BPF_REG_1
),
123 .errstr
= "math between ctx pointer and register with unbounded min value is not allowed",