History

bpf: Small BPF verifier log improvements

In particular these include: 1) Remove output of inv for scalars in print_verifier_state 2) Replace inv with scalar in verifier error messages 3) Remove _value suffixes for umin/umax/s32_min/etc (except map_value) 4) Remove output of id=0 5) Remove output of ref_obj_id=0

Mykola Lysenko committed 4 years ago

Commit 7df50721 parent 41332d620 files · +203 −197Browse files

Unified · Split

20 files
  1. kernel/bpf/verifier.c +35 −29
  2. tools/testing/selftests/bpf/prog_tests/align.c +109 −109
  3. tools/testing/selftests/bpf/prog_tests/log_buf.c +2 −2
  4. tools/testing/selftests/bpf/verifier/atomic_invalid.c +3 −3
  5. tools/testing/selftests/bpf/verifier/bounds.c +2 −2
  6. tools/testing/selftests/bpf/verifier/calls.c +3 −3
  7. tools/testing/selftests/bpf/verifier/ctx.c +2 −2
  8. tools/testing/selftests/bpf/verifier/direct_packet_access.c +1 −1
  9. tools/testing/selftests/bpf/verifier/helper_access_var_len.c +3 −3
  10. tools/testing/selftests/bpf/verifier/jmp32.c +8 −8
  11. tools/testing/selftests/bpf/verifier/precise.c +2 −2
  12. tools/testing/selftests/bpf/verifier/raw_stack.c +2 −2
  13. tools/testing/selftests/bpf/verifier/ref_tracking.c +3 −3
  14. tools/testing/selftests/bpf/verifier/search_pruning.c +1 −1
  15. tools/testing/selftests/bpf/verifier/sock.c +1 −1
  16. tools/testing/selftests/bpf/verifier/spill_fill.c +19 −19
  17. tools/testing/selftests/bpf/verifier/unpriv.c +2 −2
  18. tools/testing/selftests/bpf/verifier/value_illegal_alu.c +2 −2
  19. tools/testing/selftests/bpf/verifier/value_ptr_arith.c +2 −2
  20. tools/testing/selftests/bpf/verifier/var_off.c +1 −1
kernel/bpf/verifier.c+35−29
@@ -539,7 +539,7 @@ static const char *reg_type_str(struct bpf_verifier_env *env, · 538 unmodified lines
539539 char postfix[16] = {0}, prefix[32] = {0};
540540 static const char * const str[] = {
541541 [NOT_INIT] = "?",
542− [SCALAR_VALUE] = "inv",
542+ [SCALAR_VALUE] = "scalar",
543543 [PTR_TO_CTX] = "ctx",
544544 [CONST_PTR_TO_MAP] = "map_ptr",
545545 [PTR_TO_MAP_VALUE] = "map_value",
@@ -685,74 +685,80 @@ static void print_verifier_state(struct bpf_verifier_env *env, · 139 unmodified lines
685685 continue;
686686 verbose(env, " R%d", i);
687687 print_liveness(env, reg->live);
688− verbose(env, "=%s", reg_type_str(env, t));
688+ verbose(env, "=");
689689 if (t == SCALAR_VALUE && reg->precise)
690690 verbose(env, "P");
691691 if ((t == SCALAR_VALUE || t == PTR_TO_STACK) &&
692692 tnum_is_const(reg->var_off)) {
693693 /* reg->off should be 0 for SCALAR_VALUE */
694+ verbose(env, "%s", t == SCALAR_VALUE ? "" : reg_type_str(env, t));
694695 verbose(env, "%lld", reg->var_off.value + reg->off);
695696 } else {
697+ const char *sep = "";
698+
699+ verbose(env, "%s", reg_type_str(env, t));
696700 if (base_type(t) == PTR_TO_BTF_ID ||
697701 base_type(t) == PTR_TO_PERCPU_BTF_ID)
698702 verbose(env, "%s", kernel_type_name(reg->btf, reg->btf_id));
699− verbose(env, "(id=%d", reg->id);
700− if (reg_type_may_be_refcounted_or_null(t))
701− verbose(env, ",ref_obj_id=%d", reg->ref_obj_id);
703+ verbose(env, "(");
704+/*
705+ * _a stands for append, was shortened to avoid multiline statements below.
706+ * This macro is used to output a comma separated list of attributes.
707+ */
708+#define verbose_a(fmt, ...) ({ verbose(env, "%s" fmt, sep, __VA_ARGS__); sep = ","; })
709+
710+ if (reg->id)
711+ verbose_a("id=%d", reg->id);
712+ if (reg_type_may_be_refcounted_or_null(t) && reg->ref_obj_id)
713+ verbose_a("ref_obj_id=%d", reg->ref_obj_id);
702714 if (t != SCALAR_VALUE)
703− verbose(env, ",off=%d", reg->off);
715+ verbose_a("off=%d", reg->off);
704716 if (type_is_pkt_pointer(t))
705− verbose(env, ",r=%d", reg->range);
717+ verbose_a("r=%d", reg->range);
706718 else if (base_type(t) == CONST_PTR_TO_MAP ||
707719 base_type(t) == PTR_TO_MAP_KEY ||
708720 base_type(t) == PTR_TO_MAP_VALUE)
709− verbose(env, ",ks=%d,vs=%d",
710− reg->map_ptr->key_size,
711− reg->map_ptr->value_size);
721+ verbose_a("ks=%d,vs=%d",
722+ reg->map_ptr->key_size,
723+ reg->map_ptr->value_size);
712724 if (tnum_is_const(reg->var_off)) {
713725 /* Typically an immediate SCALAR_VALUE, but
714726 * could be a pointer whose offset is too big
715727 * for reg->off
716728 */
717− verbose(env, ",imm=%llx", reg->var_off.value);
729+ verbose_a("imm=%llx", reg->var_off.value);
718730 } else {
719731 if (reg->smin_value != reg->umin_value &&
720732 reg->smin_value != S64_MIN)
721− verbose(env, ",smin_value=%lld",
722− (long long)reg->smin_value);
733+ verbose_a("smin=%lld", (long long)reg->smin_value);
723734 if (reg->smax_value != reg->umax_value &&
724735 reg->smax_value != S64_MAX)
725− verbose(env, ",smax_value=%lld",
726− (long long)reg->smax_value);
736+ verbose_a("smax=%lld", (long long)reg->smax_value);
727737 if (reg->umin_value != 0)
728− verbose(env, ",umin_value=%llu",
729− (unsigned long long)reg->umin_value);
738+ verbose_a("umin=%llu", (unsigned long long)reg->umin_value);
730739 if (reg->umax_value != U64_MAX)
731− verbose(env, ",umax_value=%llu",
732− (unsigned long long)reg->umax_value);
740+ verbose_a("umax=%llu", (unsigned long long)reg->umax_value);
733741 if (!tnum_is_unknown(reg->var_off)) {
734742 char tn_buf[48];
735743
736744 tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
737− verbose(env, ",var_off=%s", tn_buf);
745+ verbose_a("var_off=%s", tn_buf);
738746 }
739747 if (reg->s32_min_value != reg->smin_value &&
740748 reg->s32_min_value != S32_MIN)
741− verbose(env, ",s32_min_value=%d",
742− (int)(reg->s32_min_value));
749+ verbose_a("s32_min=%d", (int)(reg->s32_min_value));
743750 if (reg->s32_max_value != reg->smax_value &&
744751 reg->s32_max_value != S32_MAX)
745− verbose(env, ",s32_max_value=%d",
746− (int)(reg->s32_max_value));
752+ verbose_a("s32_max=%d", (int)(reg->s32_max_value));
747753 if (reg->u32_min_value != reg->umin_value &&
748754 reg->u32_min_value != U32_MIN)
749− verbose(env, ",u32_min_value=%d",
750− (int)(reg->u32_min_value));
755+ verbose_a("u32_min=%d", (int)(reg->u32_min_value));
751756 if (reg->u32_max_value != reg->umax_value &&
752757 reg->u32_max_value != U32_MAX)
753− verbose(env, ",u32_max_value=%d",
754− (int)(reg->u32_max_value));
758+ verbose_a("u32_max=%d", (int)(reg->u32_max_value));
755759 }
760+#undef verbose_a
761+
756762 verbose(env, ")");
757763 }
758764 }
@@ -777,7 +783,7 @@ static void print_verifier_state(struct bpf_verifier_env *env, · 18 unmodified lines
777783 if (is_spilled_reg(&state->stack[i])) {
778784 reg = &state->stack[i].spilled_ptr;
779785 t = reg->type;
780− verbose(env, "=%s", reg_type_str(env, t));
786+ verbose(env, "=%s", t == SCALAR_VALUE ? "" : reg_type_str(env, t));
781787 if (t == SCALAR_VALUE && reg->precise)
782788 verbose(env, "P");
783789 if (t == SCALAR_VALUE && tnum_is_const(reg->var_off))
tools/testing/selftests/bpf/prog_tests/align.c+109−109
@@ -39,13 +39,13 @@ static struct bpf_align_test tests[] = { · 38 unmodified lines
3939 },
4040 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
4141 .matches = {
42− {0, "R1=ctx(id=0,off=0,imm=0)"},
42+ {0, "R1=ctx(off=0,imm=0)"},
4343 {0, "R10=fp0"},
44− {0, "R3_w=inv2"},
45− {1, "R3_w=inv4"},
46− {2, "R3_w=inv8"},
47− {3, "R3_w=inv16"},
48− {4, "R3_w=inv32"},
44+ {0, "R3_w=2"},
45+ {1, "R3_w=4"},
46+ {2, "R3_w=8"},
47+ {3, "R3_w=16"},
48+ {4, "R3_w=32"},
4949 },
5050 },
5151 {
@@ -67,19 +67,19 @@ static struct bpf_align_test tests[] = { · 15 unmodified lines
6767 },
6868 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
6969 .matches = {
70− {0, "R1=ctx(id=0,off=0,imm=0)"},
70+ {0, "R1=ctx(off=0,imm=0)"},
7171 {0, "R10=fp0"},
72− {0, "R3_w=inv1"},
73− {1, "R3_w=inv2"},
74− {2, "R3_w=inv4"},
75− {3, "R3_w=inv8"},
76− {4, "R3_w=inv16"},
77− {5, "R3_w=inv1"},
78− {6, "R4_w=inv32"},
79− {7, "R4_w=inv16"},
80− {8, "R4_w=inv8"},
81− {9, "R4_w=inv4"},
82− {10, "R4_w=inv2"},
72+ {0, "R3_w=1"},
73+ {1, "R3_w=2"},
74+ {2, "R3_w=4"},
75+ {3, "R3_w=8"},
76+ {4, "R3_w=16"},
77+ {5, "R3_w=1"},
78+ {6, "R4_w=32"},
79+ {7, "R4_w=16"},
80+ {8, "R4_w=8"},
81+ {9, "R4_w=4"},
82+ {10, "R4_w=2"},
8383 },
8484 },
8585 {
@@ -96,14 +96,14 @@ static struct bpf_align_test tests[] = { · 10 unmodified lines
9696 },
9797 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
9898 .matches = {
99− {0, "R1=ctx(id=0,off=0,imm=0)"},
99+ {0, "R1=ctx(off=0,imm=0)"},
100100 {0, "R10=fp0"},
101− {0, "R3_w=inv4"},
102− {1, "R3_w=inv8"},
103− {2, "R3_w=inv10"},
104− {3, "R4_w=inv8"},
105− {4, "R4_w=inv12"},
106− {5, "R4_w=inv14"},
101+ {0, "R3_w=4"},
102+ {1, "R3_w=8"},
103+ {2, "R3_w=10"},
104+ {3, "R4_w=8"},
105+ {4, "R4_w=12"},
106+ {5, "R4_w=14"},
107107 },
108108 },
109109 {
@@ -118,12 +118,12 @@ static struct bpf_align_test tests[] = { · 8 unmodified lines
118118 },
119119 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
120120 .matches = {
121− {0, "R1=ctx(id=0,off=0,imm=0)"},
121+ {0, "R1=ctx(off=0,imm=0)"},
122122 {0, "R10=fp0"},
123− {0, "R3_w=inv7"},
124− {1, "R3_w=inv7"},
125− {2, "R3_w=inv14"},
126− {3, "R3_w=inv56"},
123+ {0, "R3_w=7"},
124+ {1, "R3_w=7"},
125+ {2, "R3_w=14"},
126+ {3, "R3_w=56"},
127127 },
128128 },
129129
@@ -161,19 +161,19 @@ static struct bpf_align_test tests[] = { · 31 unmodified lines
161161 },
162162 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
163163 .matches = {
164− {6, "R0_w=pkt(id=0,off=8,r=8,imm=0)"},
165− {6, "R3_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
166− {7, "R3_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
167− {8, "R3_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
168− {9, "R3_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
169− {10, "R3_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
170− {12, "R3_w=pkt_end(id=0,off=0,imm=0)"},
171− {17, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
172− {18, "R4_w=inv(id=0,umax_value=8160,var_off=(0x0; 0x1fe0))"},
173− {19, "R4_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
174− {20, "R4_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
175− {21, "R4_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
176− {22, "R4_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
164+ {6, "R0_w=pkt(off=8,r=8,imm=0)"},
165+ {6, "R3_w=scalar(umax=255,var_off=(0x0; 0xff))"},
166+ {7, "R3_w=scalar(umax=510,var_off=(0x0; 0x1fe))"},
167+ {8, "R3_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
168+ {9, "R3_w=scalar(umax=2040,var_off=(0x0; 0x7f8))"},
169+ {10, "R3_w=scalar(umax=4080,var_off=(0x0; 0xff0))"},
170+ {12, "R3_w=pkt_end(off=0,imm=0)"},
171+ {17, "R4_w=scalar(umax=255,var_off=(0x0; 0xff))"},
172+ {18, "R4_w=scalar(umax=8160,var_off=(0x0; 0x1fe0))"},
173+ {19, "R4_w=scalar(umax=4080,var_off=(0x0; 0xff0))"},
174+ {20, "R4_w=scalar(umax=2040,var_off=(0x0; 0x7f8))"},
175+ {21, "R4_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
176+ {22, "R4_w=scalar(umax=510,var_off=(0x0; 0x1fe))"},
177177 },
178178 },
179179 {
@@ -194,16 +194,16 @@ static struct bpf_align_test tests[] = { · 14 unmodified lines
194194 },
195195 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
196196 .matches = {
197− {6, "R3_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
198− {7, "R4_w=inv(id=1,umax_value=255,var_off=(0x0; 0xff))"},
199− {8, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
200− {9, "R4_w=inv(id=1,umax_value=255,var_off=(0x0; 0xff))"},
201− {10, "R4_w=inv(id=0,umax_value=510,var_off=(0x0; 0x1fe))"},
202− {11, "R4_w=inv(id=1,umax_value=255,var_off=(0x0; 0xff))"},
203− {12, "R4_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
204− {13, "R4_w=inv(id=1,umax_value=255,var_off=(0x0; 0xff))"},
205− {14, "R4_w=inv(id=0,umax_value=2040,var_off=(0x0; 0x7f8))"},
206− {15, "R4_w=inv(id=0,umax_value=4080,var_off=(0x0; 0xff0))"},
197+ {6, "R3_w=scalar(umax=255,var_off=(0x0; 0xff))"},
198+ {7, "R4_w=scalar(id=1,umax=255,var_off=(0x0; 0xff))"},
199+ {8, "R4_w=scalar(umax=255,var_off=(0x0; 0xff))"},
200+ {9, "R4_w=scalar(id=1,umax=255,var_off=(0x0; 0xff))"},
201+ {10, "R4_w=scalar(umax=510,var_off=(0x0; 0x1fe))"},
202+ {11, "R4_w=scalar(id=1,umax=255,var_off=(0x0; 0xff))"},
203+ {12, "R4_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
204+ {13, "R4_w=scalar(id=1,umax=255,var_off=(0x0; 0xff))"},
205+ {14, "R4_w=scalar(umax=2040,var_off=(0x0; 0x7f8))"},
206+ {15, "R4_w=scalar(umax=4080,var_off=(0x0; 0xff0))"},
207207 },
208208 },
209209 {
@@ -234,14 +234,14 @@ static struct bpf_align_test tests[] = { · 24 unmodified lines
234234 },
235235 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
236236 .matches = {
237− {2, "R5_w=pkt(id=0,off=0,r=0,imm=0)"},
238− {4, "R5_w=pkt(id=0,off=14,r=0,imm=0)"},
239− {5, "R4_w=pkt(id=0,off=14,r=0,imm=0)"},
240− {9, "R2=pkt(id=0,off=0,r=18,imm=0)"},
241− {10, "R5=pkt(id=0,off=14,r=18,imm=0)"},
242− {10, "R4_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff))"},
243− {13, "R4_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"},
244− {14, "R4_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff))"},
237+ {2, "R5_w=pkt(off=0,r=0,imm=0)"},
238+ {4, "R5_w=pkt(off=14,r=0,imm=0)"},
239+ {5, "R4_w=pkt(off=14,r=0,imm=0)"},
240+ {9, "R2=pkt(off=0,r=18,imm=0)"},
241+ {10, "R5=pkt(off=14,r=18,imm=0)"},
242+ {10, "R4_w=scalar(umax=255,var_off=(0x0; 0xff))"},
243+ {13, "R4_w=scalar(umax=65535,var_off=(0x0; 0xffff))"},
244+ {14, "R4_w=scalar(umax=65535,var_off=(0x0; 0xffff))"},
245245 },
246246 },
247247 {
@@ -296,59 +296,59 @@ static struct bpf_align_test tests[] = { · 48 unmodified lines
296296 /* Calculated offset in R6 has unknown value, but known
297297 * alignment of 4.
298298 */
299− {6, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
300− {7, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
299+ {6, "R2_w=pkt(off=0,r=8,imm=0)"},
300+ {7, "R6_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
301301 /* Offset is added to packet pointer R5, resulting in
302302 * known fixed offset, and variable offset from R6.
303303 */
304− {11, "R5_w=pkt(id=1,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
304+ {11, "R5_w=pkt(id=1,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"},
305305 /* At the time the word size load is performed from R5,
306306 * it's total offset is NET_IP_ALIGN + reg->off (0) +
307307 * reg->aux_off (14) which is 16. Then the variable
308308 * offset is considered using reg->aux_off_align which
309309 * is 4 and meets the load's requirements.
310310 */
311− {15, "R4=pkt(id=1,off=18,r=18,umax_value=1020,var_off=(0x0; 0x3fc))"},
312− {15, "R5=pkt(id=1,off=14,r=18,umax_value=1020,var_off=(0x0; 0x3fc))"},
311+ {15, "R4=pkt(id=1,off=18,r=18,umax=1020,var_off=(0x0; 0x3fc))"},
312+ {15, "R5=pkt(id=1,off=14,r=18,umax=1020,var_off=(0x0; 0x3fc))"},
313313 /* Variable offset is added to R5 packet pointer,
314314 * resulting in auxiliary alignment of 4.
315315 */
316− {17, "R5_w=pkt(id=2,off=0,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
316+ {17, "R5_w=pkt(id=2,off=0,r=0,umax=1020,var_off=(0x0; 0x3fc))"},
317317 /* Constant offset is added to R5, resulting in
318318 * reg->off of 14.
319319 */
320− {18, "R5_w=pkt(id=2,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
320+ {18, "R5_w=pkt(id=2,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"},
321321 /* At the time the word size load is performed from R5,
322322 * its total fixed offset is NET_IP_ALIGN + reg->off
323323 * (14) which is 16. Then the variable offset is 4-byte
324324 * aligned, so the total offset is 4-byte aligned and
325325 * meets the load's requirements.
326326 */
327− {23, "R4=pkt(id=2,off=18,r=18,umax_value=1020,var_off=(0x0; 0x3fc))"},
328− {23, "R5=pkt(id=2,off=14,r=18,umax_value=1020,var_off=(0x0; 0x3fc))"},
327+ {23, "R4=pkt(id=2,off=18,r=18,umax=1020,var_off=(0x0; 0x3fc))"},
328+ {23, "R5=pkt(id=2,off=14,r=18,umax=1020,var_off=(0x0; 0x3fc))"},
329329 /* Constant offset is added to R5 packet pointer,
330330 * resulting in reg->off value of 14.
331331 */
332− {25, "R5_w=pkt(id=0,off=14,r=8"},
332+ {25, "R5_w=pkt(off=14,r=8"},
333333 /* Variable offset is added to R5, resulting in a
334334 * variable offset of (4n).
335335 */
336− {26, "R5_w=pkt(id=3,off=14,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
336+ {26, "R5_w=pkt(id=3,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"},
337337 /* Constant is added to R5 again, setting reg->off to 18. */
338− {27, "R5_w=pkt(id=3,off=18,r=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
338+ {27, "R5_w=pkt(id=3,off=18,r=0,umax=1020,var_off=(0x0; 0x3fc))"},
339339 /* And once more we add a variable; resulting var_off
340340 * is still (4n), fixed offset is not changed.
341341 * Also, we create a new reg->id.
342342 */
343− {28, "R5_w=pkt(id=4,off=18,r=0,umax_value=2040,var_off=(0x0; 0x7fc)"},
343+ {28, "R5_w=pkt(id=4,off=18,r=0,umax=2040,var_off=(0x0; 0x7fc)"},
344344 /* At the time the word size load is performed from R5,
345345 * its total fixed offset is NET_IP_ALIGN + reg->off (18)
346346 * which is 20. Then the variable offset is (4n), so
347347 * the total offset is 4-byte aligned and meets the
348348 * load's requirements.
349349 */
350− {33, "R4=pkt(id=4,off=22,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"},
351− {33, "R5=pkt(id=4,off=18,r=22,umax_value=2040,var_off=(0x0; 0x7fc)"},
350+ {33, "R4=pkt(id=4,off=22,r=22,umax=2040,var_off=(0x0; 0x7fc)"},
351+ {33, "R5=pkt(id=4,off=18,r=22,umax=2040,var_off=(0x0; 0x7fc)"},
352352 },
353353 },
354354 {
@@ -386,36 +386,36 @@ static struct bpf_align_test tests[] = { · 31 unmodified lines
386386 /* Calculated offset in R6 has unknown value, but known
387387 * alignment of 4.
388388 */
389− {6, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
390− {7, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
389+ {6, "R2_w=pkt(off=0,r=8,imm=0)"},
390+ {7, "R6_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
391391 /* Adding 14 makes R6 be (4n+2) */
392− {8, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
392+ {8, "R6_w=scalar(umin=14,umax=1034,var_off=(0x2; 0x7fc))"},
393393 /* Packet pointer has (4n+2) offset */
394− {11, "R5_w=pkt(id=1,off=0,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},
395− {12, "R4=pkt(id=1,off=4,r=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},
394+ {11, "R5_w=pkt(id=1,off=0,r=0,umin=14,umax=1034,var_off=(0x2; 0x7fc)"},
395+ {12, "R4=pkt(id=1,off=4,r=0,umin=14,umax=1034,var_off=(0x2; 0x7fc)"},
396396 /* At the time the word size load is performed from R5,
397397 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
398398 * which is 2. Then the variable offset is (4n+2), so
399399 * the total offset is 4-byte aligned and meets the
400400 * load's requirements.
401401 */
402− {15, "R5=pkt(id=1,off=0,r=4,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc)"},
402+ {15, "R5=pkt(id=1,off=0,r=4,umin=14,umax=1034,var_off=(0x2; 0x7fc)"},
403403 /* Newly read value in R6 was shifted left by 2, so has
404404 * known alignment of 4.
405405 */
406− {17, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
406+ {17, "R6_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
407407 /* Added (4n) to packet pointer's (4n+2) var_off, giving
408408 * another (4n+2).
409409 */
410− {19, "R5_w=pkt(id=2,off=0,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},
411− {20, "R4=pkt(id=2,off=4,r=0,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},
410+ {19, "R5_w=pkt(id=2,off=0,r=0,umin=14,umax=2054,var_off=(0x2; 0xffc)"},
411+ {20, "R4=pkt(id=2,off=4,r=0,umin=14,umax=2054,var_off=(0x2; 0xffc)"},
412412 /* At the time the word size load is performed from R5,
413413 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
414414 * which is 2. Then the variable offset is (4n+2), so
415415 * the total offset is 4-byte aligned and meets the
416416 * load's requirements.
417417 */
418− {23, "R5=pkt(id=2,off=0,r=4,umin_value=14,umax_value=2054,var_off=(0x2; 0xffc)"},
418+ {23, "R5=pkt(id=2,off=0,r=4,umin=14,umax=2054,var_off=(0x2; 0xffc)"},
419419 },
420420 },
421421 {
@@ -448,18 +448,18 @@ static struct bpf_align_test tests[] = { · 26 unmodified lines
448448 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
449449 .result = REJECT,
450450 .matches = {
451− {3, "R5_w=pkt_end(id=0,off=0,imm=0)"},
451+ {3, "R5_w=pkt_end(off=0,imm=0)"},
452452 /* (ptr - ptr) << 2 == unknown, (4n) */
453− {5, "R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc)"},
453+ {5, "R5_w=scalar(smax=9223372036854775804,umax=18446744073709551612,var_off=(0x0; 0xfffffffffffffffc)"},
454454 /* (4n) + 14 == (4n+2). We blow our bounds, because
455455 * the add could overflow.
456456 */
457− {6, "R5_w=inv(id=0,smin_value=-9223372036854775806,smax_value=9223372036854775806,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},
457+ {6, "R5_w=scalar(smin=-9223372036854775806,smax=9223372036854775806,umin=2,umax=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},
458458 /* Checked s>=0 */
459− {9, "R5=inv(id=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
459+ {9, "R5=scalar(umin=2,umax=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
460460 /* packet pointer + nonnegative (4n+2) */
461− {11, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
462− {12, "R4_w=pkt(id=1,off=4,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
461+ {11, "R6_w=pkt(id=1,off=0,r=0,umin=2,umax=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
462+ {12, "R4_w=pkt(id=1,off=4,r=0,umin=2,umax=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
463463 /* NET_IP_ALIGN + (4n+2) == (4n), alignment is fine.
464464 * We checked the bounds, but it might have been able
465465 * to overflow if the packet pointer started in the
@@ -467,7 +467,7 @@ static struct bpf_align_test tests[] = { · 1 unmodified line
467467 * So we did not get a 'range' on R6, and the access
468468 * attempt will fail.
469469 */
470− {15, "R6_w=pkt(id=1,off=0,r=0,umin_value=2,umax_value=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
470+ {15, "R6_w=pkt(id=1,off=0,r=0,umin=2,umax=9223372036854775806,var_off=(0x2; 0x7ffffffffffffffc)"},
471471 }
472472 },
473473 {
@@ -502,23 +502,23 @@ static struct bpf_align_test tests[] = { · 28 unmodified lines
502502 /* Calculated offset in R6 has unknown value, but known
503503 * alignment of 4.
504504 */
505− {6, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
506− {8, "R6_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
505+ {6, "R2_w=pkt(off=0,r=8,imm=0)"},
506+ {8, "R6_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
507507 /* Adding 14 makes R6 be (4n+2) */
508− {9, "R6_w=inv(id=0,umin_value=14,umax_value=1034,var_off=(0x2; 0x7fc))"},
508+ {9, "R6_w=scalar(umin=14,umax=1034,var_off=(0x2; 0x7fc))"},
509509 /* New unknown value in R7 is (4n) */
510− {10, "R7_w=inv(id=0,umax_value=1020,var_off=(0x0; 0x3fc))"},
510+ {10, "R7_w=scalar(umax=1020,var_off=(0x0; 0x3fc))"},
511511 /* Subtracting it from R6 blows our unsigned bounds */
512− {11, "R6=inv(id=0,smin_value=-1006,smax_value=1034,umin_value=2,umax_value=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},
512+ {11, "R6=scalar(smin=-1006,smax=1034,umin=2,umax=18446744073709551614,var_off=(0x2; 0xfffffffffffffffc)"},
513513 /* Checked s>= 0 */
514− {14, "R6=inv(id=0,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc))"},
514+ {14, "R6=scalar(umin=2,umax=1034,var_off=(0x2; 0x7fc))"},
515515 /* At the time the word size load is performed from R5,
516516 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
517517 * which is 2. Then the variable offset is (4n+2), so
518518 * the total offset is 4-byte aligned and meets the
519519 * load's requirements.
520520 */
521− {20, "R5=pkt(id=2,off=0,r=4,umin_value=2,umax_value=1034,var_off=(0x2; 0x7fc)"},
521+ {20, "R5=pkt(id=2,off=0,r=4,umin=2,umax=1034,var_off=(0x2; 0x7fc)"},
522522
523523 },
524524 },
@@ -556,23 +556,23 @@ static struct bpf_align_test tests[] = { · 31 unmodified lines
556556 /* Calculated offset in R6 has unknown value, but known
557557 * alignment of 4.
558558 */
559− {6, "R2_w=pkt(id=0,off=0,r=8,imm=0)"},
560− {9, "R6_w=inv(id=0,umax_value=60,var_off=(0x0; 0x3c))"},
559+ {6, "R2_w=pkt(off=0,r=8,imm=0)"},
560+ {9, "R6_w=scalar(umax=60,var_off=(0x0; 0x3c))"},
561561 /* Adding 14 makes R6 be (4n+2) */
562− {10, "R6_w=inv(id=0,umin_value=14,umax_value=74,var_off=(0x2; 0x7c))"},
562+ {10, "R6_w=scalar(umin=14,umax=74,var_off=(0x2; 0x7c))"},
563563 /* Subtracting from packet pointer overflows ubounds */
564− {13, "R5_w=pkt(id=2,off=0,r=8,umin_value=18446744073709551542,umax_value=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c)"},
564+ {13, "R5_w=pkt(id=2,off=0,r=8,umin=18446744073709551542,umax=18446744073709551602,var_off=(0xffffffffffffff82; 0x7c)"},
565565 /* New unknown value in R7 is (4n), >= 76 */
566− {14, "R7_w=inv(id=0,umin_value=76,umax_value=1096,var_off=(0x0; 0x7fc))"},
566+ {14, "R7_w=scalar(umin=76,umax=1096,var_off=(0x0; 0x7fc))"},
567567 /* Adding it to packet pointer gives nice bounds again */
568− {16, "R5_w=pkt(id=3,off=0,r=0,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"},
568+ {16, "R5_w=pkt(id=3,off=0,r=0,umin=2,umax=1082,var_off=(0x2; 0xfffffffc)"},
569569 /* At the time the word size load is performed from R5,
570570 * its total fixed offset is NET_IP_ALIGN + reg->off (0)
571571 * which is 2. Then the variable offset is (4n+2), so
572572 * the total offset is 4-byte aligned and meets the
573573 * load's requirements.
574574 */
575− {20, "R5=pkt(id=3,off=0,r=4,umin_value=2,umax_value=1082,var_off=(0x2; 0xfffffffc)"},
575+ {20, "R5=pkt(id=3,off=0,r=4,umin=2,umax=1082,var_off=(0x2; 0xfffffffc)"},
576576 },
577577 },
578578 };
@@ -648,8 +648,8 @@ static int do_test_single(struct bpf_align_test *test) · 69 unmodified lines
648648 /* Check the next line as well in case the previous line
649649 * did not have a corresponding bpf insn. Example:
650650 * func#0 @0
651− * 0: R1=ctx(id=0,off=0,imm=0) R10=fp0
652− * 0: (b7) r3 = 2 ; R3_w=inv2
651+ * 0: R1=ctx(off=0,imm=0) R10=fp0
652+ * 0: (b7) r3 = 2 ; R3_w=2
653653 */
654654 if (!strstr(line_ptr, m.match)) {
655655 cur_line = -1;
tools/testing/selftests/bpf/prog_tests/log_buf.c+2−2
@@ -78,7 +78,7 @@ static void obj_load_log_buf(void) · 77 unmodified lines
7878 ASSERT_OK_PTR(strstr(libbpf_log_buf, "prog 'bad_prog': BPF program load failed"),
7979 "libbpf_log_not_empty");
8080 ASSERT_OK_PTR(strstr(obj_log_buf, "DATASEC license"), "obj_log_not_empty");
81− ASSERT_OK_PTR(strstr(good_log_buf, "0: R1=ctx(id=0,off=0,imm=0) R10=fp0"),
81+ ASSERT_OK_PTR(strstr(good_log_buf, "0: R1=ctx(off=0,imm=0) R10=fp0"),
8282 "good_log_verbose");
8383 ASSERT_OK_PTR(strstr(bad_log_buf, "invalid access to map value, value_size=16 off=16000 size=4"),
8484 "bad_log_not_empty");
@@ -175,7 +175,7 @@ static void bpf_prog_load_log_buf(void) · 90 unmodified lines
175175 opts.log_level = 2;
176176 fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, "good_prog", "GPL",
177177 good_prog_insns, good_prog_insn_cnt, &opts);
178− ASSERT_OK_PTR(strstr(log_buf, "0: R1=ctx(id=0,off=0,imm=0) R10=fp0"), "good_log_2");
178+ ASSERT_OK_PTR(strstr(log_buf, "0: R1=ctx(off=0,imm=0) R10=fp0"), "good_log_2");
179179 ASSERT_GE(fd, 0, "good_fd2");
180180 if (fd >= 0)
181181 close(fd);
tools/testing/selftests/bpf/verifier/atomic_invalid.c+3−3
@@ -1,6 +1,6 @@
1−#define __INVALID_ATOMIC_ACCESS_TEST(op) \
1+#define __INVALID_ATOMIC_ACCESS_TEST(op) \
22 { \
3− "atomic " #op " access through non-pointer ", \
3+ "atomic " #op " access through non-pointer ", \
44 .insns = { \
55 BPF_MOV64_IMM(BPF_REG_0, 1), \
66 BPF_MOV64_IMM(BPF_REG_1, 0), \
@@ -9,7 +9,7 @@ · 2 unmodified lines
99 BPF_EXIT_INSN(), \
1010 }, \
1111 .result = REJECT, \
12− .errstr = "R1 invalid mem access 'inv'" \
12+ .errstr = "R1 invalid mem access 'scalar'" \
1313 }
1414 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD),
1515 __INVALID_ATOMIC_ACCESS_TEST(BPF_ADD | BPF_FETCH),
tools/testing/selftests/bpf/verifier/bounds.c+2−2
@@ -508,7 +508,7 @@ · 507 unmodified lines
508508 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, -1),
509509 BPF_EXIT_INSN(),
510510 },
511− .errstr_unpriv = "R0 invalid mem access 'inv'",
511+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
512512 .result_unpriv = REJECT,
513513 .result = ACCEPT
514514 },
@@ -530,7 +530,7 @@ · 15 unmodified lines
530530 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, -1),
531531 BPF_EXIT_INSN(),
532532 },
533− .errstr_unpriv = "R0 invalid mem access 'inv'",
533+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
534534 .result_unpriv = REJECT,
535535 .result = ACCEPT
536536 },
tools/testing/selftests/bpf/verifier/calls.c+3−3
@@ -188,7 +188,7 @@ · 187 unmodified lines
188188 },
189189 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
190190 .result = REJECT,
191− .errstr = "R0 invalid mem access 'inv'",
191+ .errstr = "R0 invalid mem access 'scalar'",
192192 },
193193 {
194194 "calls: multiple ret types in subprog 2",
@@ -491,7 +491,7 @@ · 296 unmodified lines
491491 BPF_EXIT_INSN(),
492492 },
493493 .result = REJECT,
494− .errstr = "R6 invalid mem access 'inv'",
494+ .errstr = "R6 invalid mem access 'scalar'",
495495 .prog_type = BPF_PROG_TYPE_XDP,
496496 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
497497 },
@@ -1697,7 +1697,7 @@ · 1199 unmodified lines
16971697 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
16981698 .fixup_map_hash_8b = { 12, 22 },
16991699 .result = REJECT,
1700− .errstr = "R0 invalid mem access 'inv'",
1700+ .errstr = "R0 invalid mem access 'scalar'",
17011701 },
17021702 {
17031703 "calls: pkt_ptr spill into caller stack",
tools/testing/selftests/bpf/verifier/ctx.c+2−2
@@ -127,7 +127,7 @@ · 126 unmodified lines
127127 .prog_type = BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
128128 .expected_attach_type = BPF_CGROUP_UDP6_SENDMSG,
129129 .result = REJECT,
130− .errstr = "R1 type=inv expected=ctx",
130+ .errstr = "R1 type=scalar expected=ctx",
131131 },
132132 {
133133 "pass ctx or null check, 4: ctx - const",
@@ -193,5 +193,5 @@ · 59 unmodified lines
193193 .prog_type = BPF_PROG_TYPE_CGROUP_SOCK,
194194 .expected_attach_type = BPF_CGROUP_INET4_POST_BIND,
195195 .result = REJECT,
196− .errstr = "R1 type=inv expected=ctx",
196+ .errstr = "R1 type=scalar expected=ctx",
197197 },
tools/testing/selftests/bpf/verifier/direct_packet_access.c+1−1
@@ -339,7 +339,7 @@ · 338 unmodified lines
339339 BPF_MOV64_IMM(BPF_REG_0, 0),
340340 BPF_EXIT_INSN(),
341341 },
342− .errstr = "R2 invalid mem access 'inv'",
342+ .errstr = "R2 invalid mem access 'scalar'",
343343 .result = REJECT,
344344 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
345345 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
tools/testing/selftests/bpf/verifier/helper_access_var_len.c+3−3
@@ -350,7 +350,7 @@ · 349 unmodified lines
350350 BPF_EMIT_CALL(BPF_FUNC_csum_diff),
351351 BPF_EXIT_INSN(),
352352 },
353− .errstr = "R1 type=inv expected=fp",
353+ .errstr = "R1 type=scalar expected=fp",
354354 .result = REJECT,
355355 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
356356 },
@@ -471,7 +471,7 @@ · 114 unmodified lines
471471 BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel),
472472 BPF_EXIT_INSN(),
473473 },
474− .errstr = "R1 type=inv expected=fp",
474+ .errstr = "R1 type=scalar expected=fp",
475475 .result = REJECT,
476476 .prog_type = BPF_PROG_TYPE_TRACEPOINT,
477477 },
@@ -484,7 +484,7 @@ · 6 unmodified lines
484484 BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel),
485485 BPF_EXIT_INSN(),
486486 },
487− .errstr = "R1 type=inv expected=fp",
487+ .errstr = "R1 type=scalar expected=fp",
488488 .result = REJECT,
489489 .prog_type = BPF_PROG_TYPE_TRACEPOINT,
490490 },
tools/testing/selftests/bpf/verifier/jmp32.c+8−8
@@ -286,7 +286,7 @@ · 285 unmodified lines
286286 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
287287 BPF_EXIT_INSN(),
288288 },
289− .errstr_unpriv = "R0 invalid mem access 'inv'",
289+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
290290 .result_unpriv = REJECT,
291291 .result = ACCEPT,
292292 .retval = 2,
@@ -356,7 +356,7 @@ · 63 unmodified lines
356356 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
357357 BPF_EXIT_INSN(),
358358 },
359− .errstr_unpriv = "R0 invalid mem access 'inv'",
359+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
360360 .result_unpriv = REJECT,
361361 .result = ACCEPT,
362362 .retval = 2,
@@ -426,7 +426,7 @@ · 63 unmodified lines
426426 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
427427 BPF_EXIT_INSN(),
428428 },
429− .errstr_unpriv = "R0 invalid mem access 'inv'",
429+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
430430 .result_unpriv = REJECT,
431431 .result = ACCEPT,
432432 .retval = 2,
@@ -496,7 +496,7 @@ · 63 unmodified lines
496496 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
497497 BPF_EXIT_INSN(),
498498 },
499− .errstr_unpriv = "R0 invalid mem access 'inv'",
499+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
500500 .result_unpriv = REJECT,
501501 .result = ACCEPT,
502502 .retval = 2,
@@ -566,7 +566,7 @@ · 63 unmodified lines
566566 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
567567 BPF_EXIT_INSN(),
568568 },
569− .errstr_unpriv = "R0 invalid mem access 'inv'",
569+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
570570 .result_unpriv = REJECT,
571571 .result = ACCEPT,
572572 .retval = 2,
@@ -636,7 +636,7 @@ · 63 unmodified lines
636636 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
637637 BPF_EXIT_INSN(),
638638 },
639− .errstr_unpriv = "R0 invalid mem access 'inv'",
639+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
640640 .result_unpriv = REJECT,
641641 .result = ACCEPT,
642642 .retval = 2,
@@ -706,7 +706,7 @@ · 63 unmodified lines
706706 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
707707 BPF_EXIT_INSN(),
708708 },
709− .errstr_unpriv = "R0 invalid mem access 'inv'",
709+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
710710 .result_unpriv = REJECT,
711711 .result = ACCEPT,
712712 .retval = 2,
@@ -776,7 +776,7 @@ · 63 unmodified lines
776776 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_0, 0),
777777 BPF_EXIT_INSN(),
778778 },
779− .errstr_unpriv = "R0 invalid mem access 'inv'",
779+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
780780 .result_unpriv = REJECT,
781781 .result = ACCEPT,
782782 .retval = 2,
tools/testing/selftests/bpf/verifier/precise.c+2−2
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 BPF_JMP_IMM(BPF_JLT, BPF_REG_2, 8, 1),
2828 BPF_EXIT_INSN(),
2929
30− BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1), /* R2=inv(umin=1, umax=8) */
30+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1), /* R2=scalar(umin=1, umax=8) */
3131 BPF_MOV64_REG(BPF_REG_1, BPF_REG_FP),
3232 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8),
3333 BPF_MOV64_IMM(BPF_REG_3, 0),
@@ -87,7 +87,7 @@ · 53 unmodified lines
8787 BPF_JMP_IMM(BPF_JLT, BPF_REG_2, 8, 1),
8888 BPF_EXIT_INSN(),
8989
90− BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1), /* R2=inv(umin=1, umax=8) */
90+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 1), /* R2=scalar(umin=1, umax=8) */
9191 BPF_MOV64_REG(BPF_REG_1, BPF_REG_FP),
9292 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -8),
9393 BPF_MOV64_IMM(BPF_REG_3, 0),
tools/testing/selftests/bpf/verifier/raw_stack.c+2−2
@@ -132,7 +132,7 @@ · 131 unmodified lines
132132 BPF_EXIT_INSN(),
133133 },
134134 .result = REJECT,
135− .errstr = "R0 invalid mem access 'inv'",
135+ .errstr = "R0 invalid mem access 'scalar'",
136136 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
137137 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
138138 },
@@ -162,7 +162,7 @@ · 23 unmodified lines
162162 BPF_EXIT_INSN(),
163163 },
164164 .result = REJECT,
165− .errstr = "R3 invalid mem access 'inv'",
165+ .errstr = "R3 invalid mem access 'scalar'",
166166 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
167167 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
168168 },
tools/testing/selftests/bpf/verifier/ref_tracking.c+3−3
@@ -162,7 +162,7 @@ · 161 unmodified lines
162162 BPF_EXIT_INSN(),
163163 },
164164 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
165− .errstr = "type=inv expected=sock",
165+ .errstr = "type=scalar expected=sock",
166166 .result = REJECT,
167167 },
168168 {
@@ -178,7 +178,7 @@ · 9 unmodified lines
178178 BPF_EXIT_INSN(),
179179 },
180180 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
181− .errstr = "type=inv expected=sock",
181+ .errstr = "type=scalar expected=sock",
182182 .result = REJECT,
183183 },
184184 {
@@ -274,7 +274,7 @@ · 89 unmodified lines
274274 BPF_EXIT_INSN(),
275275 },
276276 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
277− .errstr = "type=inv expected=sock",
277+ .errstr = "type=scalar expected=sock",
278278 .result = REJECT,
279279 },
280280 {
tools/testing/selftests/bpf/verifier/search_pruning.c+1−1
@@ -104,7 +104,7 @@ · 103 unmodified lines
104104 BPF_EXIT_INSN(),
105105 },
106106 .fixup_map_hash_8b = { 3 },
107− .errstr = "R6 invalid mem access 'inv'",
107+ .errstr = "R6 invalid mem access 'scalar'",
108108 .result = REJECT,
109109 .prog_type = BPF_PROG_TYPE_TRACEPOINT,
110110 },
tools/testing/selftests/bpf/verifier/sock.c+1−1
@@ -502,7 +502,7 @@ · 501 unmodified lines
502502 .fixup_sk_storage_map = { 11 },
503503 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
504504 .result = REJECT,
505− .errstr = "R3 type=inv expected=fp",
505+ .errstr = "R3 type=scalar expected=fp",
506506 },
507507 {
508508 "sk_storage_get(map, skb->sk, &stack_value, 1): stack_value",
tools/testing/selftests/bpf/verifier/spill_fill.c+19−19
@@ -102,7 +102,7 @@ · 101 unmodified lines
102102 BPF_EXIT_INSN(),
103103 },
104104 .errstr_unpriv = "attempt to corrupt spilled",
105− .errstr = "R0 invalid mem access 'inv",
105+ .errstr = "R0 invalid mem access 'scalar'",
106106 .result = REJECT,
107107 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
108108 },
@@ -147,11 +147,11 @@ · 38 unmodified lines
147147 BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_10, -8),
148148 /* r0 = r2 */
149149 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
150− /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv20 */
150+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=20 */
151151 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
152− /* if (r0 > r3) R0=pkt,off=20 R2=pkt R3=pkt_end R4=inv20 */
152+ /* if (r0 > r3) R0=pkt,off=20 R2=pkt R3=pkt_end R4=20 */
153153 BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
154− /* r0 = *(u32 *)r2 R0=pkt,off=20,r=20 R2=pkt,r=20 R3=pkt_end R4=inv20 */
154+ /* r0 = *(u32 *)r2 R0=pkt,off=20,r=20 R2=pkt,r=20 R3=pkt_end R4=20 */
155155 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
156156 BPF_MOV64_IMM(BPF_REG_0, 0),
157157 BPF_EXIT_INSN(),
@@ -190,11 +190,11 @@ · 32 unmodified lines
190190 BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_10, -8),
191191 /* r0 = r2 */
192192 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
193− /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=65535 */
193+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=umax=65535 */
194194 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
195− /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv,umax=65535 */
195+ /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=umax=65535 */
196196 BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
197− /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv20 */
197+ /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=20 */
198198 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
199199 BPF_MOV64_IMM(BPF_REG_0, 0),
200200 BPF_EXIT_INSN(),
@@ -222,11 +222,11 @@ · 21 unmodified lines
222222 BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_10, -8),
223223 /* r0 = r2 */
224224 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
225− /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=65535 */
225+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=umax=65535 */
226226 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
227− /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv,umax=65535 */
227+ /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=umax=65535 */
228228 BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
229− /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv20 */
229+ /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=20 */
230230 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
231231 BPF_MOV64_IMM(BPF_REG_0, 0),
232232 BPF_EXIT_INSN(),
@@ -250,11 +250,11 @@ · 17 unmodified lines
250250 BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_10, -6),
251251 /* r0 = r2 */
252252 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
253− /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=65535 */
253+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=umax=65535 */
254254 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
255− /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv,umax=65535 */
255+ /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=umax=65535 */
256256 BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
257− /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv20 */
257+ /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=20 */
258258 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
259259 BPF_MOV64_IMM(BPF_REG_0, 0),
260260 BPF_EXIT_INSN(),
@@ -280,11 +280,11 @@ · 19 unmodified lines
280280 BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_10, -4),
281281 /* r0 = r2 */
282282 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
283− /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=U32_MAX */
283+ /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=umax=U32_MAX */
284284 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4),
285− /* if (r0 > r3) R0=pkt,umax=U32_MAX R2=pkt R3=pkt_end R4=inv */
285+ /* if (r0 > r3) R0=pkt,umax=U32_MAX R2=pkt R3=pkt_end R4= */
286286 BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1),
287− /* r0 = *(u32 *)r2 R0=pkt,umax=U32_MAX R2=pkt R3=pkt_end R4=inv */
287+ /* r0 = *(u32 *)r2 R0=pkt,umax=U32_MAX R2=pkt R3=pkt_end R4= */
288288 BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0),
289289 BPF_MOV64_IMM(BPF_REG_0, 0),
290290 BPF_EXIT_INSN(),
@@ -305,13 +305,13 @@ · 14 unmodified lines
305305 BPF_JMP_IMM(BPF_JLE, BPF_REG_4, 40, 2),
306306 BPF_MOV64_IMM(BPF_REG_0, 0),
307307 BPF_EXIT_INSN(),
308− /* *(u32 *)(r10 -8) = r4 R4=inv,umax=40 */
308+ /* *(u32 *)(r10 -8) = r4 R4=umax=40 */
309309 BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_4, -8),
310310 /* r4 = (*u32 *)(r10 - 8) */
311311 BPF_LDX_MEM(BPF_W, BPF_REG_4, BPF_REG_10, -8),
312− /* r2 += r4 R2=pkt R4=inv,umax=40 */
312+ /* r2 += r4 R2=pkt R4=umax=40 */
313313 BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_4),
314− /* r0 = r2 R2=pkt,umax=40 R4=inv,umax=40 */
314+ /* r0 = r2 R2=pkt,umax=40 R4=umax=40 */
315315 BPF_MOV64_REG(BPF_REG_0, BPF_REG_2),
316316 /* r2 += 20 R0=pkt,umax=40 R2=pkt,umax=40 */
317317 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 20),
tools/testing/selftests/bpf/verifier/unpriv.c+2−2
@@ -214,7 +214,7 @@ · 213 unmodified lines
214214 BPF_EXIT_INSN(),
215215 },
216216 .result = REJECT,
217− .errstr = "R1 type=inv expected=ctx",
217+ .errstr = "R1 type=scalar expected=ctx",
218218 .prog_type = BPF_PROG_TYPE_SCHED_CLS,
219219 },
220220 {
@@ -420,7 +420,7 @@ · 199 unmodified lines
420420 BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_7, 0),
421421 BPF_EXIT_INSN(),
422422 },
423− .errstr_unpriv = "R7 invalid mem access 'inv'",
423+ .errstr_unpriv = "R7 invalid mem access 'scalar'",
424424 .result_unpriv = REJECT,
425425 .result = ACCEPT,
426426 .retval = 0,
tools/testing/selftests/bpf/verifier/value_illegal_alu.c+2−2
@@ -64,7 +64,7 @@ · 63 unmodified lines
6464 },
6565 .fixup_map_hash_48b = { 3 },
6666 .errstr_unpriv = "R0 pointer arithmetic prohibited",
67− .errstr = "invalid mem access 'inv'",
67+ .errstr = "invalid mem access 'scalar'",
6868 .result = REJECT,
6969 .result_unpriv = REJECT,
7070 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
@@ -89,7 +89,7 @@ · 18 unmodified lines
8989 },
9090 .fixup_map_hash_48b = { 3 },
9191 .errstr_unpriv = "leaking pointer from stack off -8",
92− .errstr = "R0 invalid mem access 'inv'",
92+ .errstr = "R0 invalid mem access 'scalar'",
9393 .result = REJECT,
9494 .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
9595 },
tools/testing/selftests/bpf/verifier/value_ptr_arith.c+2−2
@@ -397,7 +397,7 @@ · 396 unmodified lines
397397 .fixup_map_array_48b = { 1 },
398398 .result = ACCEPT,
399399 .result_unpriv = REJECT,
400− .errstr_unpriv = "R0 invalid mem access 'inv'",
400+ .errstr_unpriv = "R0 invalid mem access 'scalar'",
401401 .retval = 0,
402402 },
403403 {
@@ -1074,7 +1074,7 @@ · 670 unmodified lines
10741074 },
10751075 .fixup_map_array_48b = { 3 },
10761076 .result = REJECT,
1077− .errstr = "R0 invalid mem access 'inv'",
1077+ .errstr = "R0 invalid mem access 'scalar'",
10781078 .errstr_unpriv = "R0 pointer -= pointer prohibited",
10791079 },
10801080 {
tools/testing/selftests/bpf/verifier/var_off.c+1−1
@@ -131,7 +131,7 @@ · 130 unmodified lines
131131 * write might have overwritten the spilled pointer (i.e. we lose track
132132 * of the spilled register when we analyze the write).
133133 */
134− .errstr = "R2 invalid mem access 'inv'",
134+ .errstr = "R2 invalid mem access 'scalar'",
135135 .result = REJECT,
136136 },
137137 {