All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Zhaolei <zhaolei@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftrace: Avoid double-free of dyn_ftrace
Date: Tue, 24 Mar 2009 22:35:31 -0400	[thread overview]
Message-ID: <20090325023531.GA9748@goodmis.org> (raw)
In-Reply-To: <7867D4500D2F4CFFB36A9EA93C0DC2D5@zhaoleiwin>

On Wed, Mar 25, 2009 at 10:25:47AM +0800, Zhaolei wrote:
> >> > 
> >> > I'm wondering, did you trigger this in practice (if yes, how?), 
> >> > or have you found it via code review?
> >> Hello, Ingo
> >> 
> >> It is found via code review.
> > 
> > Hmm, could you explain this more. I'm thinking that this scenario should 
> > not happen, and if it does, it should probably be a bug.
> > 
> > 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.
> Hello, Steven
> 
> Thanks for your comment.
> I got your meaning, and I agree that if rec->ip >= s && rec->ip < e,
> this record is not freed.
> But IMHO, "if rec->ip >= s && rec->ip < e" is used to select records in the module,
> and function of ignore "freed record" is only its side-effect.
> So, add a special judgement to avoid "freed record" is not a bad idea.
> And I also agree your suggestion of add a WARN_ON, because this should not happened.

Hi Zhaolei,

Great! Feel free to send another patch ;-)

Note, use FTRACE_WARN_ON() macro. This way it shuts down ftrace if it is hit and 
helps to avoid further damage later.

-- Steve


  reply	other threads:[~2009-03-25  2:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13  9:14 [PATCH] ftrace: Avoid double-free of dyn_ftrace Zhaolei
2009-03-13  9:25 ` Ingo Molnar
2009-03-13  9:30   ` Zhaolei
2009-03-24 15:54     ` Steven Rostedt
2009-03-25  2:25       ` Zhaolei
2009-03-25  2:35         ` Steven Rostedt [this message]
2009-03-13  9:33 ` [tip:tracing/ftrace] ftrace: avoid " Zhaolei

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=20090325023531.GA9748@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=zhaolei@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.