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

From: Josh Poimboeuf
Date: Mon Aug 01 2016 - 12:34:32 EST


On Fri, Jul 29, 2016 at 06:55:21PM -0400, Steven Rostedt wrote:
> > @@ -108,18 +97,23 @@ print_context_stack(struct task_struct *task,
> > stack = (unsigned long *)task_stack_page(task);
> >
> > while (valid_stack_ptr(task, stack, sizeof(*stack), end)) {
> > - unsigned long addr;
> > + unsigned long addr = *stack;
> >
> > addr = *stack;
> > if (__kernel_text_address(addr)) {
> > + int reliable = 0;
> > + unsigned long real_addr;
> > +
> > if ((unsigned long) stack == bp + sizeof(long)) {
> > - ops->address(data, addr, 1);
> > + reliable = 1;
> > frame = frame->next_frame;
> > bp = (unsigned long) frame;
> > - } else {
> > - ops->address(data, addr, 0);
> > }
> > - print_ftrace_graph_addr(addr, data, ops, task, graph);
> > +
> > + real_addr = ftrace_graph_ret_addr(task, graph, addr);
> > + if (addr != real_addr)
> > + ops->address(data, addr, 0);
> > + ops->address(data, real_addr, reliable);
>
> Note this changes behavior, as the original code had the ret_to_handler
> first. This makes it second. (I fixed this below).

Hm, as far as I can tell this actually keeps the original behavior. The
"unreliable" ret_to_handler is still printed first, no?

--
Josh