• Andrii Nakryiko's avatar
    bpf: improve stack slot state printing · d54e0f6c
    Andrii Nakryiko authored
    Improve stack slot state printing to provide more useful and relevant
    information, especially for dynptrs. While previously we'd see something
    like:
    
      8: (85) call bpf_ringbuf_reserve_dynptr#198   ; R0_w=scalar() fp-8_w=dddddddd fp-16_w=dddddddd refs=2
    
    Now we'll see way more useful:
    
      8: (85) call bpf_ringbuf_reserve_dynptr#198   ; R0_w=scalar() fp-16_w=dynptr_ringbuf(ref_id=2) refs=2
    
    I experimented with printing the range of slots taken by dynptr,
    something like:
    
      fp-16..8_w=dynptr_ringbuf(ref_id=2)
    
    But it felt very awkward and pretty useless. So we print the lowest
    address (most negative offset) only.
    
    The general structure of this code is now also set up for easier
    extension and will accommodate ITER slots naturally.
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20230302235015.2044271-2-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    d54e0f6c
verifier.c 528 KB