From: David Ahern <dsahern@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
"Suzuki K. Poulose" <suzuki@in.ibm.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 11/17] perf tools: Remove the node from rblist in strlist__remove
Date: Wed, 05 Sep 2012 17:32:02 -0600 [thread overview]
Message-ID: <5047E0F2.60404@gmail.com> (raw)
In-Reply-To: <1346886537-11621-12-git-send-email-acme@infradead.org>
This one needs to go through urgent.
On 9/5/12 5:08 PM, Arnaldo Carvalho de Melo wrote:
> From: Suzuki K. Poulose <suzuki@in.ibm.com>
>
> The following commit:
>
> author David Ahern <dsahern@gmail.com>
> Tue, 31 Jul 2012 04:31:33 +0000 (22:31 -0600)
> committer Arnaldo Carvalho de Melo <acme@redhat.com>
> Fri, 3 Aug 2012 13:39:51 +0000 (10:39 -0300)
> commit ee8dd3ca43f151d9fbe1edeef68fb8a77eb9f047
>
> causes a double free during a probe deletion as the node is never
> removed from the list via strlist__remove(), even though it gets
> 'deleted' (read free()'d). This causes a double free when we do
> strlist__delete() as the node is already deleted but present in the
> rblist.
>
> [suzukikp@suzukikp perf]$ sudo ./perf probe -a do_fork
> Added new event:
> probe:do_fork (on do_fork)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe:do_fork -aR sleep 1
>
> [suzukikp@suzukikp perf]$ sudo ./perf probe -d do_fork
> Removed event: probe:do_fork
> *** glibc detected *** ./perf: double free or corruption (fasttop): 0x000000000133d600 ***
> ======= Backtrace: =========
> /lib64/libc.so.6[0x38eec7dda6]
> ./perf(rblist__delete+0x5c)[0x47d3dc]
> ./perf(del_perf_probe_events+0xb6)[0x47b826]
> ./perf(cmd_probe+0x471)[0x42c8d1]
> ./perf[0x4150b3]
> ./perf(main+0x501)[0x4148e1]
> /lib64/libc.so.6(__libc_start_main+0xed)[0x38eec2169d]
> ./perf[0x414a61]
>
> Make sure we remove the node from the rblist before we delete the node.
> The rblist__remove_node() will invoke rblist->node_delete, which will
> take care of deleting the node with the suitable function provided by
> the user.
>
> Reported-by: Ananth N. Mavinakayanahalli <ananth@in.ibm.com>
> Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
> Acked-by: David Ahern <dsahern@gmail.com>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: http://lkml.kernel.org/r/20120829055840.7802.1459.stgit@suzukikp.in.ibm.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/util/strlist.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
> index 95856ff..155d8b7 100644
> --- a/tools/perf/util/strlist.c
> +++ b/tools/perf/util/strlist.c
> @@ -93,7 +93,7 @@ out:
>
> void strlist__remove(struct strlist *slist, struct str_node *snode)
> {
> - str_node__delete(snode, slist->dupstr);
> + rblist__remove_node(&slist->rblist, &snode->rb_node);
> }
>
> struct str_node *strlist__find(struct strlist *slist, const char *entry)
>
next prev parent reply other threads:[~2012-09-05 23:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 23:08 [GIT PULL 00/17] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 01/17] tools lib traceevent: Modify header to work in C++ programs Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 02/17] perf session: flush_sample_queue needs to handle errors from handlers Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 03/17] perf tool: handle errors in synthesized event functions Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 04/17] perf lock: Remove use of die and handle errors Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 05/17] perf stat: Remove use of die/exit " Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 06/17] perf help: Remove use of die " Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 07/17] perf script: Remove use of die/exit Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 08/17] perf record: " Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 09/17] perf tools: Fix x86 builds with ARCH specified on the command line Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 10/17] perf tools: Fix intlist node removal Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 11/17] perf tools: Remove the node from rblist in strlist__remove Arnaldo Carvalho de Melo
2012-09-05 23:32 ` David Ahern [this message]
2012-09-05 23:08 ` [PATCH 12/17] perf tools: remove unneeded include of network header files Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 13/17] perf header: Use evlist->nr_entries on write_event_desc() Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 14/17] perf header: Set tracepoint event name only if not set Arnaldo Carvalho de Melo
2012-09-06 0:01 ` David Ahern
2012-09-06 1:30 ` Namhyung Kim
2012-09-05 23:08 ` [PATCH 15/17] perf header: Swap pmu mapping numbers if needed Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 16/17] perf tools: Replace mempcpy with memcpy Arnaldo Carvalho de Melo
2012-09-05 23:08 ` [PATCH 17/17] perf tools: Allow user to indicate path to objdump in command line Arnaldo Carvalho de Melo
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=5047E0F2.60404@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=acme@redhat.com \
--cc=ananth@in.ibm.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=suzuki@in.ibm.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