On Thu, Dec 4, 2025 at 11:24 AM David Blaikie <[email protected]> wrote: > > > > On Thu, Dec 4, 2025 at 11:12 AM Y Song <[email protected]> wrote: >> >> On Thu, Dec 4, 2025 at 10:35 AM David Blaikie <[email protected]> wrote: >> > >> > OK, let's see if I understand this correctly: >> > >> > BPF lets users write functions and have calls to those functions injected >> > at the start of some other function's implementation/when that other >> > function is called. >> > >> > And those calls are injected without any kind of fixup/remapping between >> > function arguments to the injected function and function arguments to the >> > original. >> > >> > You're currently proposing adding the lowered signature to DWARF in some >> > way, so that users can write the injected function in terms of the lowered >> > signature, and BPF can validate that they match? (so the user has to write >> > the injected function to match the lowered signature - and if >> > optimizations change they have to change their code?) >> >> Currently we do not really validate BPF program arguments and rely on >> users to check vmlinux BTF to find the signature. > > > OK, so there's a human step here - you want the lowered/optimized signature > in the DWARF, so a tool can print it out in a dump/report of some kind, that > the user reads and then uses to write the callback with the correct lowered > signature?
Yes. vmlinux BTF can be dumped as C style to show the correct lowered signature. > > That seems like a real stretch for DWARF... - some other tool could tell > users what the lowered signature was & users could use that to determine what > signature to write, perhaps? Or are there other uses/needs for the lowered > signature? I am not aware of other uses/needs for the lowered signature. So you recommend another tool to find lowered signatures? This could be an option? Any details? Maybe encode a section like .debug_lowered_signature to encode those functions with lowered signature? So this will have no impact for dwarf and needed users (e.g. pahole) can parse .debug_lowered_signature to get the lowered signatures? Another option is from Jakub Jelinek to use function cloning to encode lowered signatures. I have tried before but it made some user-visible changes in lldb. See https://lists.dwarfstd.org/pipermail/dwarf-discuss/2025-December/002766.html -- Dwarf-discuss mailing list [email protected] https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss
