• Yonghong Song's avatar
    bpf: fix bpffs bitfield pretty print · 17e3ac81
    Yonghong Song authored
    Commit 9d5f9f70 ("bpf: btf: fix struct/union/fwd types
    with kind_flag") introduced kind_flag and used bitfield_size
    in the btf_member to directly pretty print member values.
    
    The commit contained a bug where the incorrect parameters could be
    passed to function btf_bitfield_seq_show(). The bits_offset
    parameter in the function expects a value less than 8.
    Instead, the member offset in the structure is passed.
    
    The below is btf_bitfield_seq_show() func signature:
      void btf_bitfield_seq_show(void *data, u8 bits_offset,
                                 u8 nr_bits, struct seq_file *m)
    both bits_offset and nr_bits are u8 type. If the bitfield
    member offset is greater than 256, incorrect value will
    be printed.
    
    This patch fixed the issue by calculating correct proper
    data offset and bits_offset similar to non kind_flag case.
    
    Fixes: 9d5f9f70 ("bpf: btf: fix struct/union/fwd types with kind_flag")
    Acked-by: 's avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: 's avatarYonghong Song <yhs@fb.com>
    Signed-off-by: 's avatarDaniel Borkmann <daniel@iogearbox.net>
    17e3ac81
Name
Last commit
Last update
..
Makefile Loading commit data...
arraymap.c Loading commit data...
bpf_lru_list.c Loading commit data...
bpf_lru_list.h Loading commit data...
btf.c Loading commit data...
cgroup.c Loading commit data...
core.c Loading commit data...
cpumap.c Loading commit data...
devmap.c Loading commit data...
disasm.c Loading commit data...
disasm.h Loading commit data...
hashtab.c Loading commit data...
helpers.c Loading commit data...
inode.c Loading commit data...
local_storage.c Loading commit data...
lpm_trie.c Loading commit data...
map_in_map.c Loading commit data...
map_in_map.h Loading commit data...
offload.c Loading commit data...
percpu_freelist.c Loading commit data...
percpu_freelist.h Loading commit data...
queue_stack_maps.c Loading commit data...
reuseport_array.c Loading commit data...
stackmap.c Loading commit data...
syscall.c Loading commit data...
tnum.c Loading commit data...
verifier.c Loading commit data...
xskmap.c Loading commit data...