mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	srostedt@redhat.com, "Huang, Ying" <ying.huang@intel.com>
Subject: [RFC]ftrace: fix a unallocated memory access in function_graph
Date: Tue, 27 Jul 2010 16:06:34 +0800	[thread overview]
Message-ID: <1280217994.32400.76.camel@sli10-desk.sh.intel.com> (raw)

With CONFIG_DEBUG_PAGEALLOC, I observed a unallocated memory access in
function_graph trace. It appears we find a small size entry in ring buffer, but
we access it as a big size entry. The access overflows a page size and touch
a unallocated page.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 79f4bac..33b379d 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -507,7 +507,10 @@ get_return_for_leaf(struct trace_iterator *iter,
 			 * if the output fails.
 			 */
 			data->ent = *curr;
-			data->ret = *next;
+			if (next->ent.type == TRACE_GRAPH_RET)
+				data->ret = *next;
+			else
+				data->ret.ent.type = next->ent.type;
 		}
 	}
 



             reply	other threads:[~2010-07-27  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27  8:06 Shaohua Li [this message]
2010-08-06 16:09 ` Steven Rostedt
2010-08-16 17:30 ` [tip:perf/urgent] tracing: Fix an " tip-bot for Shaohua Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280217994.32400.76.camel@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=srostedt@redhat.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®