提交 a5c2a4c9 编写于 作者: A Andi Kleen 提交者: Arnaldo Carvalho de Melo

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: NAndi 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 da88c7f7
...@@ -558,13 +558,17 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, ...@@ -558,13 +558,17 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
struct map *map; struct map *map;
struct kmap *kmap; struct kmap *kmap;
int err; 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 * 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 * available use this, and after it is use this as a fallback for older
* kernels. * kernels.
*/ */
union perf_event *event = zalloc((sizeof(event->mmap) + event = zalloc((sizeof(event->mmap) + machine->id_hdr_size));
machine->id_hdr_size));
if (event == NULL) { if (event == NULL) {
pr_debug("Not enough memory synthesizing mmap event " pr_debug("Not enough memory synthesizing mmap event "
"for kernel modules\n"); "for kernel modules\n");
......
...@@ -119,7 +119,7 @@ struct perf_session *perf_session__new(struct perf_data_file *file, ...@@ -119,7 +119,7 @@ struct perf_session *perf_session__new(struct perf_data_file *file,
* kernel MMAP event, in perf_event__process_mmap(). * kernel MMAP event, in perf_event__process_mmap().
*/ */
if (perf_session__create_kernel_maps(session) < 0) if (perf_session__create_kernel_maps(session) < 0)
goto out_delete; pr_warning("Cannot read kernel map\n");
} }
if (tool && tool->ordering_requires_timestamps && if (tool && tool->ordering_requires_timestamps &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册