linux/tools/perf
Suzuki K. Poulose 4592281403 perf tools: Remove the node from rblist in strlist__remove
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	ee8dd3ca43

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>
2012-09-05 17:36:42 -03:00
..
arch perf tools: Support for DWARF CFI unwinding on post processing 2012-08-11 15:06:56 -03:00
bench perf bench: Fix confused variable namings and descriptions in mem subsystem 2012-07-02 14:35:45 -03:00
config perf tools: Add libunwind dependency for DWARF CFI unwinding 2012-08-10 16:46:07 -03:00
Documentation perf script perl/python: Fix libexec scripts path in Documentation 2012-08-20 09:30:36 -03:00
python perf python: Use attr.watermark in twatch.py 2012-01-30 18:38:23 -02:00
scripts perf script python: Correct handler check and spelling errors 2012-08-09 13:26:19 -03:00
ui perf hists: Rename and move some functions 2012-08-20 09:47:31 -03:00
util perf tools: Remove the node from rblist in strlist__remove 2012-09-05 17:36:42 -03:00
.gitignore perf tools: Ignore auto-generated bison/flex files 2012-04-14 13:50:39 -03:00
bash_completion perf tools: Support for events bash completion 2012-08-09 15:59:26 -03:00
builtin-annotate.c perf tools: Convert critical messages to ui__error() 2012-05-29 11:53:42 -03:00
builtin-bench.c perf bench: Documentation update 2012-06-27 13:17:48 -03:00
builtin-buildid-cache.c perf buildid: add perfconfig option to specify buildid cache dir 2010-06-05 09:34:04 -03:00
builtin-buildid-list.c perf symbols: Introduce symbol__elf_init() 2012-08-09 16:19:14 -03:00
builtin-diff.c perf diff: Fix to work with new hists design 2012-03-22 15:12:09 -03:00
builtin-evlist.c perf tools: Move all users of event_name to perf_evsel__name 2012-06-19 13:06:20 -03:00
builtin-help.c perf help: Remove use of die and handle errors 2012-09-05 17:21:10 -03:00
builtin-inject.c perf symbols: Support minimal build without libelf 2012-08-09 16:26:38 -03:00
builtin-kmem.c perf kmem: Use evsel->tp_format and perf_sample 2012-08-07 23:44:20 -03:00
builtin-kvm.c perf kvm: Do guest-only counting by default 2012-01-06 15:47:37 -02:00
builtin-list.c perf tools: Support for events bash completion 2012-08-09 15:59:26 -03:00
builtin-lock.c perf lock: Remove use of die and handle errors 2012-09-05 17:19:38 -03:00
builtin-probe.c perf probe: Detect probe target when m/x options are absent 2012-05-11 13:58:53 -03:00
builtin-record.c perf record: Remove use of die/exit 2012-09-05 17:22:41 -03:00
builtin-report.c perf tools: Support for DWARF CFI unwinding on post processing 2012-08-11 15:06:56 -03:00
builtin-sched.c perf sched: Use perf_sample 2012-08-07 23:46:19 -03:00
builtin-script.c perf script: Remove use of die/exit 2012-09-05 17:21:39 -03:00
builtin-stat.c perf stat: Remove use of die/exit and handle errors 2012-09-05 17:20:24 -03:00
builtin-test.c perf evlist: Introduce evsel list accessors 2012-08-15 10:14:18 -03:00
builtin-timechart.c perf report: Accept fifos as input file 2011-12-23 17:01:03 -02:00
builtin-top.c perf evlist: Introduce evsel list accessors 2012-08-15 10:14:18 -03:00
builtin.h perf tools: Make perf.data more self-descriptive (v8) 2011-10-07 17:01:24 -03:00
command-list.txt perf symbols: Support minimal build without libelf 2012-08-09 16:26:38 -03:00
CREDITS
design.txt perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP 2012-05-31 11:38:42 -03:00
Makefile perf tools: Fix x86 builds with ARCH specified on the command line 2012-09-05 17:23:30 -03:00
MANIFEST perf tools: Fix make tarballs 2012-05-30 15:05:59 -03:00
perf-archive.sh perf archive: Correct cutting of symbolic link 2012-04-14 13:52:15 -03:00
perf.c perf symbols: Support minimal build without libelf 2012-08-09 16:26:38 -03:00
perf.h perf tools: Support for DWARF mode callchain 2012-08-11 15:07:18 -03:00