Skip to content

Commit fab4f4e

Browse files
acmelKali-
authored andcommitted
perf session: Invalidate last_match when removing threads from rb_tree
[ 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 <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Andi Kleen <[email protected]>
1 parent 88cb997 commit fab4f4e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/session.c

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ void perf_session__delete(struct perf_session *self)
134134

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

0 commit comments

Comments
 (0)