[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090728153322.GA6215@nowhere>
Date: Tue, 28 Jul 2009 17:33:24 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: fix invalid function_graph entry
On Tue, Jul 28, 2009 at 08:11:24PM +0800, Lai Jiangshan wrote:
>
> print_graph_entry() consumes current event, if this event
> is the last event in the page, the ring_buffer may reuse
> the page. It will become invalid.
>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
Queued for .31, thanks Lai!
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index abf7c4a..02102a3 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -835,9 +835,16 @@ print_graph_function(struct trace_iterator *iter)
>
> switch (entry->type) {
> case TRACE_GRAPH_ENT: {
> - struct ftrace_graph_ent_entry *field;
> + /*
> + * print_graph_entry() may consume the current event,
> + * thus @field may become invalid, so we need to save it.
> + * sizeof(struct ftrace_graph_ent_entry) is very small,
> + * it is safely saved at the stack.
> + */
> + struct ftrace_graph_ent_entry *field, saved;
> trace_assign_type(field, entry);
> - return print_graph_entry(field, s, iter);
> + saved = *field;
> + return print_graph_entry(&saved, s, iter);
> }
> case TRACE_GRAPH_RET: {
> struct ftrace_graph_ret_entry *field;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists