Re: [PATCH 05/19] x86/dumpstack: fix function graph tracing stack dump reliability issues

From: Josh Poimboeuf
Date: Mon Aug 01 2016 - 12:48:10 EST


On Fri, Jul 29, 2016 at 06:55:21PM -0400, Steven Rostedt wrote:
> Here's my patch that should be applied on top.
>
> Maybe add a Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx> along
> with your SOB. But you should remain Author.

[...]

> @@ -123,13 +124,16 @@ print_context_stack_bp(struct task_struc
>
> while (valid_stack_ptr(task, ret_addr, sizeof(*ret_addr), end)) {
> unsigned long addr = *ret_addr;
> + unsigned long real_addr;
>
> if (!__kernel_text_address(addr))
> break;
>
> - addr = ftrace_graph_ret_addr(task, graph, addr);
> - if (ops->address(data, addr, 1))
> + real_addr = ftrace_graph_ret_addr(task, graph, addr);
> + if (ops->address(data, real_addr, 1))
> break;
> + if (real_addr != addr)
> + ops->address(data, addr, 0);
> frame = frame->next_frame;
> ret_addr = &frame->return_address;
> }

Actually this hunk isn't needed because all users of
print_context_stack_bp() only care about "reliable" addresses. With
frame pointers enabled, the only place "unreliable" addresses are used
is in show_trace_log_lvl() -- and it uses the print_context_stack()
callback.

I rely on that fact in the new frame pointer unwind code: it only
reports reliable addresses.

--
Josh