perf probe: Do not access kallsyms when analyzing user binaries
Do not access kallsyms to show available variables and show source lines in user binaries. This behavior always requires the root privilege when sysctl sets kernel.kptr_restrict=1, but we don't need it just for analyzing user binaries. Without this patch (by normal user, kptr_restrict=1): ---- $ perf probe -x ./perf -V add_cmdname Failed to init vmlinux path. Error: Failed to show vars. $ perf probe -x ./perf -L add_cmdname Failed to init vmlinux path. Error: Failed to show lines. ---- With this patch: ---- $ perf probe -x ./perf -V add_cmdname Available variables at add_cmdname @<perf_unknown_cmd_config+144> (No matched variables) @<list_commands_in_dir+160> (No matched variables) @<add_cmdname+0> char* name size_t len struct cmdnames* cmds $ perf probe -x ./perf -L add_cmdname <add_cmdname@/home/fedora/ksrc/linux-3/tools/perf/util/help.c:0> 0 void add_cmdname(struct cmdnames *cmds, const char *name, size_t len) 1 { 2 struct cmdname *ent = malloc(sizeof(*ent) + len + 1); 4 ent->len = len; 5 memcpy(ent->name, name, len); 6 ent->name[len] = 0; ... ---- Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: david lerner <dlernerdroid@gmail.com> Cc: linux-perf-user@vger.kernel.org Cc: yrl.pp-manager.tt@hitachi.com Link: http://lkml.kernel.org/r/20140917084054.3722.73975.stgit@kbuild-f20.novalocal [ Added missing 'bool user' argument to the !DWARF show_line_range() stub ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
c657f423ae
commit
2b394bc446
3 changed files with 9 additions and 6 deletions
|
@ -697,11 +697,11 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int show_line_range(struct line_range *lr, const char *module)
|
||||
int show_line_range(struct line_range *lr, const char *module, bool user)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = init_symbol_maps(false);
|
||||
ret = init_symbol_maps(user);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = __show_line_range(lr, module);
|
||||
|
@ -776,7 +776,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
|
|||
int i, ret = 0;
|
||||
struct debuginfo *dinfo;
|
||||
|
||||
ret = init_symbol_maps(false);
|
||||
ret = init_symbol_maps(pevs->uprobes);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -822,7 +822,8 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
|
|||
}
|
||||
|
||||
int show_line_range(struct line_range *lr __maybe_unused,
|
||||
const char *module __maybe_unused)
|
||||
const char *module __maybe_unused,
|
||||
bool user __maybe_unused)
|
||||
{
|
||||
pr_warning("Debuginfo-analysis is not supported.\n");
|
||||
return -ENOSYS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue