• Andrii Nakryiko's avatar
    selftests/bpf: allow to adjust BPF verifier log level in veristat · e310efc5
    Andrii Nakryiko authored
    Add -l (--log-level) flag to override default BPF verifier log lever.
    This only matters in verbose mode, which is the mode in which veristat
    emits verifier log for each processed BPF program.
    
    This is important because for successfully verified BPF programs
    log_level 1 is empty, as BPF verifier truncates all the successfully
    verified paths. So -l2 is the only way to actually get BPF verifier log
    in practice. It looks sometihng like this:
    
      [vmuser@archvm bpf]$ sudo ./veristat xdp_tx.bpf.o -vl2
      Processing 'xdp_tx.bpf.o'...
      PROCESSING xdp_tx.bpf.o/xdp_tx, DURATION US: 19, VERDICT: success, VERIFIER LOG:
      func#0 @0
      0: R1=ctx(off=0,imm=0) R10=fp0
      ; return XDP_TX;
      0: (b4) w0 = 3                        ; R0_w=3
      1: (95) exit
      verification time 19 usec
      stack depth 0
      processed 2 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
    
      File          Program  Verdict  Duration (us)  Total insns  Total states  Peak states
      ------------  -------  -------  -------------  -----------  ------------  -----------
      xdp_tx.bpf.o  xdp_tx   success             19            2             0            0
      ------------  -------  -------  -------------  -----------  ------------  -----------
      Done. Processed 1 files, 0 programs. Skipped 1 files, 0 programs.
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20220923175913.3272430-6-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    e310efc5
veristat.c 32.3 KB