mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhaolei" <zhaolei@cn.fujitsu.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Steven Rostedt ;" <rostedt@goodmis.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ftrace: Avoid double-free of dyn_ftrace
Date: Fri, 13 Mar 2009 17:30:40 +0800	[thread overview]
Message-ID: <18199AAD941A4071B7FD8A0D6C67733A@zhaoleiwin> (raw)
In-Reply-To: <20090313092558.GD2571@elte.hu>

* From: "Ingo Molnar" <mingo@elte.hu>
> 
> * Zhaolei <zhaolei@cn.fujitsu.com> wrote:
> 
>> If dyn_ftrace is free before ftrace_release(), 
>> ftrace_release() will free it again and make 
>> ftrace_free_records wrong.
>> 
>> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
>> ---
>>  kernel/trace/ftrace.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>> 
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index d33d306..26c45aa 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -356,7 +356,8 @@ 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))
>> + if ((rec->ip >= s) && (rec->ip < e) &&
>> +     !(rec->flags & FTRACE_FL_FREE))
>>  ftrace_free_rec(rec);
> 
> Applied to tip:tracing/ftrace, thanks!
> 
> 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.

B.R.
Zhaolei
> 
> Ingo
> 
>ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2009-03-13  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13  9:14 Zhaolei
2009-03-13  9:25 ` Ingo Molnar
2009-03-13  9:30   ` Zhaolei [this message]
2009-03-24 15:54     ` Steven Rostedt
2009-03-25  2:25       ` Zhaolei
2009-03-25  2:35         ` Steven Rostedt
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=18199AAD941A4071B7FD8A0D6C67733A@zhaoleiwin \
    --to=zhaolei@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /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®