Re: [PATCH v5 bpf-next 8/9] libbpf,bpf: share BTF relocate-related code with kernel

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

 



On 31/05/2024 10:34, Eduard Zingerman wrote:
> On Tue, 2024-05-28 at 13:24 +0100, Alan Maguire wrote:
>> Share relocation implementation with the kernel.  As part of this,
>> we also need the type/string visitation functions so add them to a
>> btf_common.c file that also gets shared with the kernel. Relocation
>> code in kernel and userspace is identical save for the impementation
>> of the reparenting of split BTF to the relocated base BTF and
>> retrieval of BTF header from "struct btf"; these small functions
>> need separate user-space and kernel implementations.
>>
>> One other wrinkle on the kernel side is we have to map .BTF.ids in
>> modules as they were generated with the type ids used at BTF encoding
>> time. btf_relocate() optionally returns an array mapping from old BTF
>> ids to relocated ids, so we use that to fix up these references where
>> needed for kfuncs.
>>
>> Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
>> ---
> 
> I think we also need a test or a few tests to verify that ID sets are
> converted correctly.
> 

We sort of get that implicitly since bpf_testmod.ko will have a
.BTF.base section, so its ID sets need to be relocated for the existing
tests to work correctly. I'm thinking something that makes use of a
bpf_iter_testmod_seq*() function while validating its BTF id > num base
types might work, or did you have something specific in mind? Thanks!

Alan

> Acked-by: Eduard Zingerman <eddyz87@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