• Raman Shukhau's avatar
    bpftool: Adding support for BTF program names · b662000a
    Raman Shukhau authored
    `bpftool prog list` and other bpftool subcommands that show
    BPF program names currently get them from bpf_prog_info.name.
    That field is limited to 16 (BPF_OBJ_NAME_LEN) chars which leads
    to truncated names since many progs have much longer names.
    
    The idea of this change is to improve all bpftool commands that
    output prog name so that bpftool uses info from BTF to print
    program names if available.
    
    It tries bpf_prog_info.name first and fall back to btf only if
    the name is suspected to be truncated (has 15 chars length).
    
    Right now `bpftool p show id <id>` returns capped prog name
    
    <id>: kprobe  name example_cap_cap  tag 712e...
    ...
    
    With this change it would return
    
    <id>: kprobe  name example_cap_capable  tag 712e...
    ...
    
    Note, other commands that print prog names (e.g. "bpftool
    cgroup tree") are also addressed in this change.
    Signed-off-by: default avatarRaman Shukhau <ramasha@fb.com>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20220119100255.1068997-1-ramasha@fb.com
    b662000a
cgroup.c 11.2 KB