Re: [PATCH 1/2] ftrace/x86: Add frames pointers to trampoline as necessary

From: Steven Rostedt
Date: Wed Nov 19 2014 - 13:39:05 EST


On Wed, 19 Nov 2014 19:26:48 +0100 (CET)
Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:

> On Tue, 18 Nov 2014, Steven Rostedt wrote:
> > From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
> >
> > When CONFIG_FRAME_POINTERS are enabled, it is required that the
> > ftrace_caller and ftrace_regs_caller trampolines set up frame pointers
> > otherwise a stack trace from a function call wont print the functions
> > that called the trampoline. This is due to a check in
> > __save_stack_address():
> >
> > #ifdef CONFIG_FRAME_POINTER
> > if (!reliable)
> > return;
> > #endif
> >
> > The "reliable" variable is only set if the function address is equal to
> > contents of the address before the address the frame pointer register
> > points to. If the frame pointer is not set up for the ftrace caller
> > then this will fail the reliable test. It will miss the function that
> > called the trampoline. Worse yet, if fentry is used (gcc 4.6 and
> > beyond), it will also miss the parent, as the fentry is called before
> > the stack frame is set up. That means the bp frame pointer points
> > to the stack of just before the parent function was called.
> >
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> > Cc: x86@xxxxxxxxxx
> > Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
>
> Shouldn't this be tagged stable?

>From the cover letter:

"I stated testing the other triggers and discovered two other bugs.
One was caused by my latest changes, but the other one has been in
mainline for some time. It's been there since 3.16, and I haven't
tested it further. It's not that big of a bug so I'm not labeling
it with stable."

I guess I can tag it. I have to see how far back it goes. My configs
for the kernels I use this with didn't have FRAME_POINTER enabled, so I
never noticed. I noticed it with my test configs.

>
> Acked-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>

Thanks!

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/