diff options
author | Igor Lubashev <ilubashe@akamai.com> | 2019-08-27 04:39:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-02 10:34:39 +0300 |
commit | 44b3ff57c209bbc9cd38279597209ae8a599ae5e (patch) | |
tree | c8f45378b27ccf7fa4b53618cc499f8e3513a5aa /tools | |
parent | 87335852c5d9ec629f80bb2257b9a9945962b719 (diff) | |
download | linux-44b3ff57c209bbc9cd38279597209ae8a599ae5e.tar.xz |
perf event: Check ref_reloc_sym before using it
commit e9a6882f267a8105461066e3ea6b4b6b9be1b807 upstream.
Check for ref_reloc_sym before using it instead of checking
symbol_conf.kptr_restrict and relying solely on that check.
Reported-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Igor Lubashev <ilubashe@akamai.com>
Tested-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1566869956-7154-2-git-send-email-ilubashe@akamai.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/event.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index a19e840db54a..70cada80d185 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -794,11 +794,13 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, int err; union perf_event *event; - if (symbol_conf.kptr_restrict) - return -1; if (map == NULL) return -1; + kmap = map__kmap(map); + if (!kmap->ref_reloc_sym) + return -1; + /* * We should get this from /sys/kernel/sections/.text, but till that is * available use this, and after it is use this as a fallback for older @@ -822,7 +824,6 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; } - kmap = map__kmap(map); size = snprintf(event->mmap.filename, sizeof(event->mmap.filename), "%s%s", mmap_name, kmap->ref_reloc_sym->name) + 1; size = PERF_ALIGN(size, sizeof(u64)); |