diff options
author | Yonghong Song <yhs@fb.com> | 2018-06-11 22:35:48 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-06-13 02:03:17 +0200 |
commit | 73df93c57c0b18195a2fe5429747e00018b3e863 (patch) | |
tree | d5f8d08b8f9b96a5241e182142f50e51d488230d /tools/objtool/cfi.h | |
parent | 5d902372ba5f416261c79123f02e49c664c7118f (diff) | |
download | linux-73df93c57c0b18195a2fe5429747e00018b3e863.tar.gz |
tools/bpftool: fix a bug in bpftool perf
Commit b04df400c302 ("tools/bpftool: add perf subcommand")
introduced bpftool subcommand perf to query bpf program
kuprobe and tracepoint attachments.
The perf subcommand will first test whether bpf subcommand
BPF_TASK_FD_QUERY is supported in kernel or not. It does it
by opening a file with argv[0] and feeds the file descriptor
and current task pid to the kernel for querying.
Such an approach won't work if the argv[0] cannot be opened
successfully in the current directory. This is especially
true when bpftool is accessible through PATH env variable.
The error below reflects the open failure for file argv[0]
at home directory.
[yhs@localhost ~]$ which bpftool
/usr/local/sbin/bpftool
[yhs@localhost ~]$ bpftool perf
Error: perf_query_support: No such file or directory
To fix the issue, let us open root directory ("/")
which exists in every linux system. With the fix, the
error message will correctly reflect the permission issue.
[yhs@localhost ~]$ which bpftool
/usr/local/sbin/bpftool
[yhs@localhost ~]$ bpftool perf
Error: perf_query_support: Operation not permitted
HINT: non root or kernel doesn't support TASK_FD_QUERY
Fixes: b04df400c302 ("tools/bpftool: add perf subcommand")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/objtool/cfi.h')
0 files changed, 0 insertions, 0 deletions