[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1651e205-87d6-3243-7532-a46d4749a9d0@iogearbox.net>
Date: Wed, 13 Jun 2018 02:04:26 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Yonghong Song <yhs@...com>, ast@...com, netdev@...r.kernel.org
Cc: kernel-team@...com
Subject: Re: [PATCH bpf v3] tools/bpftool: fix a bug in bpftool perf
On 06/12/2018 07:35 AM, Yonghong Song wrote:
> 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@...alhost ~]$ which bpftool
> /usr/local/sbin/bpftool
> [yhs@...alhost ~]$ 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@...alhost ~]$ which bpftool
> /usr/local/sbin/bpftool
> [yhs@...alhost ~]$ 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@...nel.org>
> Signed-off-by: Yonghong Song <yhs@...com>
Applied to bpf, thanks Yonghong!
Powered by blists - more mailing lists