lkml.org 
[lkml]   [2015]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v4 0/3] Compile-time stack frame pointer validation
    On Wed, May 20, 2015 at 09:03:37AM -0700, Andy Lutomirski wrote:
    > On Wed, May 20, 2015 at 7:48 AM, Ingo Molnar <mingo@kernel.org> wrote:
    > > Yeah, so many of these seem to be 'leaf only' functions: functions
    > > that don't ever call functions themselves.
    > >
    > > So lets assume we always have CONFIG_FRAME_POINTERS=y.
    > >
    > > If they don't set up a frame pointer then they in essence won't show
    > > up in the call chain - but normally they wouldn't because they call
    > > nothing.
    > >
    > > If they trigger an exception/fault or if they get hit by an interrupt
    > > then I think we'll still correctly walk the stack - just those
    > > functions might be missing from the deterministic call chain, right?
    > > (it will still show up as a '?' entry.)
    >
    > I've never quite understood what the '?' means.

    It basically means "here's a function address we found on the stack,
    which may or may not have been called." It's needed because stack
    walking isn't currently 100% reliable.

    > > If they crash then we'll see them because the crashing RIP will be
    > > printed.
    > >
    > > So I'm wondering what the x86 policy here should be: to create frame
    > > pointers in them or not. Cc:-ed a few more gents for thoughts.
    > >
    >
    > I think it would be nice to have full DWARF unwind support for
    > everything at some point. Unfortunately, I don't see any easy path to
    > getting there. It doesn't help that AFAIK no one has ever proposed a
    > usable in-kernel DWARF unwinder.
    >
    > It also doesn't help that writing correct CFI annotations in inline
    > asm can be very complicated.
    >
    > I think that ia64 manages to have complete unwind support. How did
    > they manage it?
    >
    > If we had an unwinder, it would be relatively straightforward to write
    > something perf-based that would frequently check that we can unwind
    > all the way out of an NMI back to userspace and warn if we couldn't.

    I agree that DWARF unwind support would be nice. I have some plans
    about how to achieve that in future patch sets. It includes several
    pieces:

    - compile-time DWARF data validation (using some similar approaches to
    this patch set)

    - run time DWARF data validation, including:
    - a DWARF unwinder which doesn't blindly trust any of the DWARF data
    - ensuring DWARF and frame pointer data are consistent with each other
    - ensuring it can walk all the way to the bottom of the stack
    - a DEBUG option which validates the stack periodically from an NMI
    and/or schedule()

    --
    Josh


    \
     
     \ /
      Last update: 2015-05-20 19:01    [W:4.190 / U:0.324 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site