mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][GIT PULL] ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release()
@ 2009-03-25 23:04 Steven Rostedt
  2009-03-26 10:01 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2009-03-25 23:04 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Frédéric Weisbecker, Andrew Morton, Zhaolei


Ingo,

Please pull the latest tip/tracing/ftrace-1 tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/ftrace-1


Zhaolei (1):
      ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release()

----
 kernel/trace/ftrace.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---------------------------
commit 2a4efa42450762cbfa5c5712aa4cc9f06924c9fd
Author: Zhaolei <zhaolei@cn.fujitsu.com>
Date:   Wed Mar 25 12:06:05 2009 +0800

    ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release()
    
     "Because when we call ftrace_free_rec we change the rec->ip to point to the
      next record in the chain. Something is very wrong if rec->ip >= s &&
      rec->ip < e and the record is already free."
    
     "Note, use FTRACE_WARN_ON() macro. This way it shuts down ftrace if it is
      hit and helps to avoid further damage later."
                       -- Steven Rostedt <rostedt@goodmis.org>
    
    Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: Steven Rostedt <srostedt@redhat.com>

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7b8722b..1752a63 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -358,9 +358,14 @@ void ftrace_release(void *start, unsigned long size)
 
 	mutex_lock(&ftrace_lock);
 	do_for_each_ftrace_rec(pg, rec) {
-		if ((rec->ip >= s) && (rec->ip < e) &&
-		    !(rec->flags & FTRACE_FL_FREE))
+		if ((rec->ip >= s) && (rec->ip < e)) {
+			/*
+			 * rec->ip is changed in ftrace_free_rec()
+			 * It should not between s and e if record was freed.
+			 */
+			FTRACE_WARN_ON(rec->flags & FTRACE_FL_FREE);
 			ftrace_free_rec(rec);
+		}
 	} while_for_each_ftrace_rec();
 	mutex_unlock(&ftrace_lock);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-26 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 23:04 [PATCH][GIT PULL] ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release() Steven Rostedt
2009-03-26 10:01 ` Ingo Molnar

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®