Re: [PATCH 7/7] DWARF: add the config option

From: H. Peter Anvin
Date: Fri May 19 2017 - 17:02:09 EST


On 05/19/17 13:53, Josh Poimboeuf wrote:
>>
>> One instance of the structure would exist for each time the stack
>> pointer changes, e.g. for every function entry, push/pop, and rsp
>> add/subtract. The data could be assembled and sorted offline, possibly
>> derived from DWARF, or more likely, generated by objtool. After doing
>> some rough calculations, I think the section size would be comparable to
>> the sizes of the DWARF .eh_frame sections it would replace.
>>
>> If it worked, the "undwarf" unwinder would be a lot simpler than a real
>> DWARF unwinder. And validating the sanity of the data at runtime would
>> be a lot more straightforward. It could ensure that each stack pointer
>> is within the bounds of the current stack, like our current unwinder
>> does.
>
> I've been hacking away at this, and so far it's working well. The code
> is much simpler than a DWARF unwinder. Right now the kernel piece is
> only ~350 lines of code. The vast majority of the changes are in
> objtool.
>
> It's now successfully unwinding through entry code and most other asm
> files, dumping entry regs, dealing with aligned stacks, dynamic stacks,
> etc.
>
> Here's the struct in its current state:

How are you handling control flow?

-hpa