On Thu, Apr 07, 2022 at 03:25:09PM -0500, madvenka@xxxxxxxxxxxxxxxxxxx wrote: > The solution > ============ > > The goal here is to use the absolute minimum CFI needed to compute the FP at > every instruction address. The unwinder can compute the FP in each frame, > compare the actual FP with the computed one and validate the actual FP. > > Objtool is enhanced to parse the CFI, extract just the rules required, > encode them in compact data structures and create special sections for > the rules. The unwinder uses the special sections to find the rules for > a given instruction address and compute the FP. > > Objtool can be invoked as follows: > > objtool dwarf generate <object-file> > > The version of the DWARF standard supported in this work is version 4. The > official documentation for this version is here: > > https://dwarfstd.org/doc/DWARF4.pdf > > Section 6.4 contains the description of the CFI. The problem is of course that DWARF is only available for compiler generated code and doesn't cover assembly code, of which is there is always lots. I suppose you can go add DWARF annotations to all the assembly, but IIRC those are pretty terrible. We were *REALLY* happy to delete all that nasty from the x86 code. On top of that, AFAIK compilers don't generally consider DWARF generation to be a correctness issue. For them it's debug info and having it be correct is nice but not required. So using it as input for something that's required to be correct, seems unfortunate.