Re: BUG in pahole?: strange error in tests/flexible_arrays.sh

Tony Ambardar
2025-05-02T20:39:10Z

On Fri, May 02, 2025 at 09:18:56AM +0100, Alan Maguire wrote:
> On 02/05/2025 03:39, Tony Ambardar wrote:
> > Hello all,
> >
> > I ran into the following running the latest pahole tests:
> >
> > $ vmlinux=~/linux/vmlinux ./tests/tests
> > 1: Validation of BTF encoding of functions; this may take some time: Ok
> > 2: Default BTF on a system without BTF: Ok
> > 3: Flexible arrays accounting: pahole: type 'bpf_empty_prog_array' not found
> > pahole: type 'kstatmount' not found
> > pahole: type 'crypto_lskcipher' not found
> > pahole: type 'crypto_sig' not found
> > pahole: type 'hash_ctx' not found
> > pahole: type 'scsi_stream_status_header' not found
> > pahole: type 'virtnet_info' not found
> > pahole: type 'geneve_dev' not found
> > pahole: type 'geneve_config' not found
> > pahole: type 'lirc_fh' not found
> > pahole: type 'scmi_registered_events_desc' not found
> > pahole: type 'events_queue' not found
> > pahole: type 'hid_debug_list' not found
> > pahole: type 'flow_offload_action' not found
> > pahole: type 'nft_rule_dp_last' not found
> > pahole: type 'nft_rhash_elem' not found
> > pahole: type 'nft_hash_elem' not found
> > pahole: type 'nft_bitmap_elem' not found
> > pahole: type 'nft_rbtree_elem' not found
> > pahole: type 'nft_pipapo_elem' not found
> > pahole: type 'xt_standard_target' not found
> > pahole: type 'xt_error_target' not found
> > pahole: type 'ipt_standard' not found
> > pahole: type 'ipt_error' not found
> > pahole: type 'ip6t_standard' not found
> > pahole: type 'ip6t_error' not found
> >
> > This is simple to reproduce (e.g. code in flexible_arrays.sh):
> >
> > $ pahole kstatmount ~/linux/vmlinux
> > pahole: type 'kstatmount' not found
> >
> > But despite the above:
> >
> > $ bpftool btf dump file ~/linux/vmlinux format raw|grep kstatmount
> > [13145] STRUCT 'kstatmount' size=624 vlen=8
> >
> > And:
> >
> > $ pahole -C kstatmount ~/linux/vmlinux
> > struct kstatmount {
> > struct statmount * buf; /* 0 4 */
> > ...
> > };
> >
> > Has this been seen before? Am I missing something? Any insight folks have
> > would be appreciated.
> >
> > The same behaviour is also seen with '.tmp_vmlinux1.btf.o', which I attach.
> >
> > Many thanks,
> > Tony Ambardar
>
> hi Tony, I've seen this too (with a slightly different cast of
> characters); I keep meaning to look into it but haven't had a chance yet
> so thanks for doing some investigation! Seems like it is a bug in type
> display rather than in BTF generation at least..
>
> Alan

Thanks for confirming this -- I was worried it might be a side-effect of
my function-encoding patch. Out of curiosity, how does option "-C" affect
BTF parsing or pahole operation? It wasn't clear to me just what "Show
just this class" means/implies...

Cheers,
Tony