• Andrii Nakryiko's avatar
    libbpf: Improve logging around BPF program loading · ad9a7f96
    Andrii Nakryiko authored
    Add missing "prog '%s': " prefixes in few places and use consistently
    markers for beginning and end of program load logs. Here's an example of
    log output:
    
    libbpf: prog 'handler': BPF program load failed: Permission denied
    libbpf: -- BEGIN PROG LOAD LOG ---
    arg#0 reference type('UNKNOWN ') size cannot be determined: -22
    ; out1 = in1;
    0: (18) r1 = 0xffffc9000cdcc000
    2: (61) r1 = *(u32 *)(r1 +0)
    
    ...
    
    81: (63) *(u32 *)(r4 +0) = r5
     R1_w=map_value(id=0,off=16,ks=4,vs=20,imm=0) R4=map_value(id=0,off=400,ks=4,vs=16,imm=0)
    invalid access to map value, value_size=16 off=400 size=4
    R4 min value is outside of the allowed memory range
    processed 63 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
     -- END PROG LOAD LOG --
    libbpf: failed to load program 'handler'
    libbpf: failed to load object 'test_skeleton'
    
    The entire verifier log, including BEGIN and END markers are now always
    youtput during a single print callback call. This should make it much
    easier to post-process or parse it, if necessary. It's not an explicit
    API guarantee, but it can be reasonably expected to stay like that.
    
    Also __bpf_object__open is renamed to bpf_object_open() as it's always
    an adventure to find the exact function that implements bpf_object's
    open phase, so drop the double underscored and use internal libbpf
    naming convention.
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20211209193840.1248570-6-andrii@kernel.org
    ad9a7f96
bpf_tcp_ca.c 8.05 KB