lkml.org 
[lkml]   [2011]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [1/275] perf session: Invalidate last_match when removing threads from rb_tree
Date
2.6.35-longterm review patch.  If anyone has any objections, please let me know.

------------------
From: Arnaldo Carvalho de Melo <acme@redhat.com>

[ upstream commit 70597f21f128b7dd6a2490078bea99d704b6f8c3 ]

If we receive two PERF_RECORD_EXIT for the same thread, we can end up
reusing session->last_match and trying to remove the thread twice from
the rb_tree, causing a segfault, so invalidade last_match in
perf_session__remove_thread.

Receiving two PERF_RECORD_EXIT for the same thread is a bug, but its a
harmless one if we make the tool more robust, like this patch does.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
tools/perf/util/session.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/tools/perf/util/session.c
===================================================================
--- linux-2.6.35.y.orig/tools/perf/util/session.c 2011-03-29 22:52:06.578019604 -0700
+++ linux-2.6.35.y/tools/perf/util/session.c 2011-03-29 23:02:58.140347711 -0700
@@ -134,6 +134,7 @@

void perf_session__remove_thread(struct perf_session *self, struct thread *th)
{
+ self->last_match = NULL;
rb_erase(&th->rb_node, &self->threads);
/*
* We may have references to this thread, for instance in some hist_entry

\
 
 \ /
  Last update: 2011-03-30 23:07    [W:1.003 / U:0.872 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site