From: Chenggang Qin <chenggang.qin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Chenggang Qin <chenggang.qcg@taobao.com>,
David Ahern <dsahern@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Arjan van de Ven <arjan@linux.intel.com>,
Namhyung Kim <namhyung@gmail.com>,
Yanmin Zhang <yanmin.zhang@intel.com>,
Wu Fengguang <fengguang.wu@intel.com>,
Mike Galbraith <efault@gmx.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 2/3] perf core: Fix a mmap & munmap mismatches bug in dso__load
Date: Sun, 1 Sep 2013 23:29:44 +0800 [thread overview]
Message-ID: <1378049385-4466-2-git-send-email-chenggang.qin@gmail.com> (raw)
In-Reply-To: <1378049385-4466-1-git-send-email-chenggang.qin@gmail.com>
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>
---
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
next prev parent reply other threads:[~2013-09-01 15:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-01 15:29 [PATCH 1/3] perf core: Fix a mmap and munmap mismatched bug Chenggang Qin
2013-09-01 15:29 ` Chenggang Qin [this message]
2013-09-03 9:02 ` [PATCH 2/3] perf core: Fix a mmap & munmap mismatches bug in dso__load Namhyung Kim
2013-09-01 15:29 ` [PATCH 3/3] perf core: Fix a memory leak bug because symbol__delete is ignored Chenggang Qin
2013-09-03 9:02 ` Namhyung Kim
2013-09-03 9:01 ` [PATCH 1/3] perf core: Fix a mmap and munmap mismatched bug Namhyung Kim
2013-10-11 0:27 Chenggang Qin
2013-10-11 0:27 ` [PATCH 2/3] perf core: Fix a mmap & munmap mismatches bug in dso__load Chenggang Qin
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=1378049385-4466-2-git-send-email-chenggang.qin@gmail.com \
--to=chenggang.qin@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=chenggang.qcg@taobao.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=paulus@samba.org \
--cc=yanmin.zhang@intel.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
Powered by JetHome