Commit 119a9af
committed
WIP: selftests/bpf: Fix arm perf ctx for verifier_global_subprogs
Use bpf_user_pt_regs_t for perf ctx arg to avoid below failures. This type
previously added because "long" type in struct pt_regs on 32-bit arm evals
to wrong size in 64-bit BPF VM, resulting in errors like:
run_subtest:PASS:obj_open_mem 0 nsec
libbpf: prog 'arg_tag_ctx_perf': BPF program load failed: -EINVAL
libbpf: prog 'arg_tag_ctx_perf': failed to load: -EINVAL
libbpf: failed to load object 'verifier_global_subprogs'
run_subtest:FAIL:unexpected_load_failure unexpected error: -22 (errno 22)
VERIFIER LOG:
=============
func#0 @0
func#1 @15
func#2 @21
func#3 @23
func#4 @25
Live regs before insn:
0: .12345.... (bf) r6 = r1
1: .123456... (85) call pc+13
2: 0.23456... (bc) w7 = w0
3: ..234567.. (bf) r1 = r6
4: .1234567.. (85) call pc+16
5: 0.234567.. (bc) w8 = w0
6: ..2345678. (0c) w8 += w7
7: ..23456.8. (bf) r1 = r6
8: .123456.8. (85) call pc+14
9: 0.23456.8. (0c) w8 += w0
10: ..23456.8. (bf) r1 = r6
11: .12345..8. (85) call pc+13
12: 0.......8. (0c) w8 += w0
13: ........8. (bc) w0 = w8
14: 0......... (95) exit
15: .1........ (18) r2 = 0xdfc7d008
17: .12....... (b4) w3 = 1024
18: .123...... (b7) r4 = 0
19: .1234..... (85) call bpf_get_stack#67
20: 0......... (95) exit
21: .......... (b4) w0 = 0
22: 0......... (95) exit
23: .......... (b4) w0 = 0
24: 0......... (95) exit
25: .......... (b4) w0 = 0
26: 0......... (95) exit
arg#0 reference type('UNKNOWN ') size cannot be determined: -22
0: R1=ctx() R10=fp0
; int arg_tag_ctx_perf(void *ctx) @ verifier_global_subprogs.c:271
0: (bf) r6 = r1 ; R1=ctx() R6=ctx()
; return subprog_ctx_tag(ctx) + @ verifier_global_subprogs.c:273
1: (85) call pc+13
Func#1 ('subprog_ctx_tag') is global and assumed valid.
2: R0=scalar()
2: (bc) w7 = w0 ; R0=scalar() R7=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
; perf_subprog_regs(ctx) + @ verifier_global_subprogs.c:274
3: (bf) r1 = r6 ; R1=ctx() R6=ctx()
4: (85) call pc+16
arg#0 should be `struct bpf_perf_event_data *`
Caller passes invalid args into func#2 ('perf_subprog_regs')
processed 5 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
=============
torvalds#514/14 verifier_global_subprogs/arg_tag_ctx_perf:FAIL
Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>1 parent 7ac1cd9 commit 119a9af
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| 251 | + | |
| 252 | + | |
251 | 253 | | |
252 | 254 | | |
253 | 255 | | |
| |||
0 commit comments