Re: [PATCH dwarves v3 1/1] btf_encoder: handle .BTF_ids section endianness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 27, 2024 at 01:59:55PM +0000, Vadim Fedorenko wrote:
> On 27/11/2024 01:50, Eduard Zingerman wrote:
> > btf_encoder__tag_kfuncs() reads .BTF_ids section to identify a set of
> > kfuncs present in the ELF file being processed.
> > This section consists of:
> > - arrays of uint32_t elements;
> > - arrays of records with the following structure:
> >    struct btf_id_and_flag {
> >        uint32_t id;
> >        uint32_t flags;
> >    };
> > 
> > When endianness of a binary operated by pahole differs from the host
> > system's endianness, these fields require byte-swapping before use.
> > Currently, this byte-swapping does not occur, resulting in kfuncs not
> > being marked with declaration tags.
> > 
> > This commit resolves the issue by using elf_getdata_rawchunk()
> > function to read .BTF_ids section data. When called with ELF_T_WORD as
> > 'type' parameter it does necessary byte order conversion
> > (only if host and elf endianness do not match).
> > 
> > Cc: Alan Maguire <alan.maguire@xxxxxxxxxx>
> > Cc: Andrii Nakryiko <andrii@xxxxxxxxxx>
> > Cc: Daniel Xu <dxu@xxxxxxxxx>
> > Cc: Jiri Olsa <olsajiri@xxxxxxxxx>
> > Cc: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
> > Cc: Vadim Fedorenko <vadfed@xxxxxxxx>
> > Fixes: 72e88f29c6f7 ("pahole: Inject kfunc decl tags into BTF")
> > Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>

> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@xxxxxxxxx>

Tested:

acme@number:~/git/pahole$ 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: Ok
  4: Pretty printing of files using DWARF type information: Ok
  5: Parallel reproducible DWARF Loading/Serial BTF encoding: Ok
/home/acme/git/pahole
acme@number:~/git/pahole$

And applied.

- Arnaldo




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux