Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
perf.17853
perf-mmap-fix-accessing-unmapped-mmap-in-perf_m...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perf-mmap-fix-accessing-unmapped-mmap-in-perf_mmap__read_done.patch of Package perf.17853
From: Kan Liang <kan.liang@linux.intel.com> Date: Mon, 26 Mar 2018 09:42:09 -0400 Subject: perf mmap: Fix accessing unmapped mmap in perf_mmap__read_done() Git-commit: f58385f629c87a9e210108b39c1f4950d0363ad2 Patch-mainline: v4.17-rc1 References: git-fixes(FATE#325579) There is a segmentation fault when running 'perf trace'. For example: [root@jouet e]# perf trace -e *chdir -o /tmp/bla perf report --ignore-vmlinux -i ../perf.data The perf_mmap__consume() could unmap the mmap. It needs to check the refcnt in perf_mmap__read_done(). Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Fixes: ee023de05f35 ("perf mmap: Introduce perf_mmap__read_done()") Link: http://lkml.kernel.org/r/1522071729-16776-1-git-send-email-kan.liang@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Tony Jones <tonyj@suse.de> --- tools/perf/util/mmap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 38ca3ffb9d61..f6cfc52ff1fe 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -317,5 +317,11 @@ int perf_mmap__push(struct perf_mmap *md, void *to, */ void perf_mmap__read_done(struct perf_mmap *map) { + /* + * Check if event was unmapped due to a POLLHUP/POLLERR. + */ + if (!refcount_read(&map->refcnt)) + return; + map->prev = perf_mmap__read_head(map); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor