[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <OEhWEyNG4cqhFinY3nHBef8R8vM_Xwc9zmYfae9IrXJJXFDtH1YbEskmd2N5aFVaI8YNOYWfaiEZjFsRC80XUPfgcPYr0jR1hrBjnKHFY9Q=@protonmail.com>
Date: Fri, 10 Jan 2025 16:41:20 +0000
From: vadorovsky@...tonmail.com
To: Dave Tucker <dave@...cker.co.uk>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Tamir Duberstein <tamird@...il.com>, Alice Ryhl <aliceryhl@...gle.com>, Neal Gompa <neal@...pa.dev>, Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Matthew Maurer <mmaurer@...gle.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, Matthias Maennich <maennich@...gle.com>, bpf <bpf@...r.kernel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, John Fastabend <john.fastabend@...il.com>, Eric Curtin <ecurtin@...hat.com>, Martin Reboredo <yakoyoku@...il.com>, Alessandro Decina <alessandro.d@...il.com>
Subject: Re: [PATCH] rust: Disallow BTF generation with Rust + LTO
On Friday, January 10th, 2025 at 5:22 PM, Dave Tucker <dave@...cker.co.uk> wrote:
> > On 9 Jan 2025, at 22:39, Arnaldo Carvalho de Melo acme@...nel.org 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
Powered by blists - more mailing lists