RE: [PATCH bpf] bpf: force .BTF section start to zero when dumping from vmlinux

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

 



Stanislav Fomichev wrote:
> While trying to figure out why fentry_fexit selftest doesn't pass for me
> (old pahole, broken BTF), I found out that my latest patch can break vmlinux
> .BTF generation. objcopy preserves section start when doing --only-section,
> so there is a chance (depending on where pahole inserts .BTF section) to
> have leading empty zeroes. Let's explicitly force section offset to zero.
> 
> Before:
> $ objcopy --set-section-flags .BTF=alloc -O binary \
> 	--only-section=.BTF vmlinux .btf.vmlinux.bin
> $ xxd .btf.vmlinux.bin | head -n1
> 00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
> 
> After:
> $ objcopy --change-section-address .BTF=0 \
> 	--set-section-flags .BTF=alloc -O binary \
> 	--only-section=.BTF vmlinux .btf.vmlinux.bin
> $ xxd .btf.vmlinux.bin | head -n1
> 00000000: 9feb 0100 1800 0000 0000 0000 80e1 1c00  ................
>           ^BTF magic
> 
> As part of this change, I'm also dropping '2>/dev/null' from objcopy
> invocation to be able to catch possible other issues (objcopy doesn't
> produce any warnings for me anymore, it did before with --dump-section).

Agree dropping /dev/null seems like a good choice. Otherwise seems reasonable
to me.

Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>



[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