Re: [PATCH] rust: Disallow BTF generation with Rust + LTO

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

 



On Friday, January 10th, 2025 at 5:22 PM, Dave Tucker <dave@xxxxxxxxxxxxx> wrote:

> > On 9 Jan 2025, at 22:39, Arnaldo Carvalho de Melo acme@xxxxxxxxxx wrote:
> > And sure this will be refused by the kernel, lots of stuff that have
> > invalid names, probably need to turn those into void as well as a
> > continuation of this hack, then prune, maybe that is it, we'll see.
> 
> 
> Rather than voiding the names you can do something like this [0] to
> coerce them into a format that the kernel is happy with. We initally
> voided names but the resulting BTF was unusable since you couldn’t
> lookup types by name.

Regarding the names, I would recommend to do exactly what we're doing in bpf-linker[0], which is converting each character not supported by C to `_[hex_representation]_`. This way, we make sure that two different types can't produce the same names in BTF.

An another important fixup we do is ignoring data-carrying enums[1], I think pahole could that do for now as well. That said, I think a long-term solution would be teaching the kernel to accept them.

Cheers,
Michal

[0] https://github.com/aya-rs/bpf-linker/blob/v0.9.13/src/llvm/di.rs#L34-L60
[1] https://github.com/aya-rs/bpf-linker/blob/v0.9.13/src/llvm/di.rs#L129-L132





[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