lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] perf core: Fix a mmap & munmap mismatches bug in dso__load
Date
From: Chenggang Qin <chenggang.qcg@taobao.com>

Some dsos' symsrc is neither syms_ss or runtime_ss. In this situation, the
corresponding ELF file is opened and mmapped in symsrc__init(), but they will
be not closed and munmapped in any place.
This bug can lead to mmap & munmap mismatched, the mmap areas will exist during
the life of perf. We can think this is a memory leak.
This patch fixed the bug. symsrc__destroy() is called while the opened and
mmaped ELF file has neither symtlb section nor dynsym section, and opdsec
section.
Thanks.

Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Yanmin Zhang <yanmin.zhang@intel.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chenggang Qin <chenggang.qcg@taobao.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>

---
tools/perf/util/symbol.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index d5528e1..9675866 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -828,7 +828,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)

if (syms_ss && runtime_ss)
break;
- }
+ } else
+ symsrc__destroy(ss);

}

--
1.7.8.rc2.5.g815b


\
 
 \ /
  Last update: 2013-10-11 03:21    [W:0.072 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site