perf probe: Report possible permission error for map__load() failure
authorMasami Hiramatsu <mhiramat@kernel.org>
Fri, 4 Jun 2021 15:30:58 +0000 (00:30 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 4 Jun 2021 18:43:37 +0000 (15:43 -0300)
commitf4f1c42953c7f03a35cd7bc49c16f35911f50a0a
tree6819cd76c96fcb9672fc38b14a72273e4e11817c
parentfe4f3eb1fd5ab4bec5f105ef6e51bacac698af3b
perf probe: Report possible permission error for map__load() failure

Report possible permission error including kptr_restrict setting
for map__load() failure. This can happen when non-superuser runs
perf probe.

With this patch, perf probe shows the following message.

 $ perf probe vfs_read
 Failed to load symbols from /proc/kallsyms
 Please ensure you can read the /proc/kallsyms symbol addresses.
 If the /proc/sys/kernel/kptr_restrict is '2', you can not read
 kernel symbol address even if you are a superuser. Please change
 it to '1'. If kptr_restrict is '1', the superuser can read the
 symbol addresses.
 In that case, please run this command again with sudo.
   Error: Failed to add events.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lore.kernel.org/lkml/162282065877.448336.10047912688119745151.stgit@devnote2
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c