diff options
author | Andi Kleen <ak@linux.intel.com> | 2014-09-24 23:39:54 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-26 15:51:41 +0200 |
commit | a5c2a4c9561cbbd374231bd341936dae716df9dd (patch) | |
tree | 64c783c65a8765b304cd09065ee1c580f124d32c /tools/perf/util/event.c | |
parent | perf stat: Fix --per-core on multi socket systems (diff) | |
download | linux-a5c2a4c9561cbbd374231bd341936dae716df9dd.tar.xz linux-a5c2a4c9561cbbd374231bd341936dae716df9dd.zip |
perf tools: Fix perf record as non root with kptr_restrict == 1
Currently perf record always errors out when you run it as non-root with
kptr_restrict == 1, which is often the default.
Make it only warn instead and fix the kernel resolve code to not
segfault later. Profiling works still fine, except kernel symbols are
not resolved.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1411594794-7229-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r-- | tools/perf/util/event.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index ed558191c0b3..4af6b279e34a 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -558,13 +558,17 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, struct map *map; struct kmap *kmap; int err; + union perf_event *event; + + if (machine->vmlinux_maps[0] == NULL) + 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 * kernels. */ - union perf_event *event = zalloc((sizeof(event->mmap) + - machine->id_hdr_size)); + event = zalloc((sizeof(event->mmap) + machine->id_hdr_size)); if (event == NULL) { pr_debug("Not enough memory synthesizing mmap event " "for kernel modules\n"); |