linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hengqi Chen <hengqi.chen@gmail.com>
To: Martin KaFai Lau <kafai@fb.com>, Florent Revest <revest@chromium.org>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, kpsingh@kernel.org, jackmanb@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Allow bpf_d_path in perf_event_mmap
Date: Fri, 29 Oct 2021 23:17:41 +0800	[thread overview]
Message-ID: <10a745cc-5942-70ff-483f-a5c77a9776a2@gmail.com> (raw)
In-Reply-To: <20211028224653.qhuwkp75fridkzpw@kafai-mbp.dhcp.thefacebook.com>



On 10/29/21 6:46 AM, Martin KaFai Lau wrote:
> On Thu, Oct 28, 2021 at 06:43:57PM +0200, Florent Revest wrote:
>> Allow the helper to be called from the perf_event_mmap hook. This is
>> convenient to lookup vma->vm_file and implement a similar logic as
>> perf_event_mmap_event in BPF.
> From struct vm_area_struct:
> 	struct file * vm_file;          /* File we map to (can be NULL). */
> 
> Under perf_event_mmap, vm_file won't be NULL or bpf_d_path can handle it?
> 

Hmm, is perf_event_mmap a proper tracing target ?
It does not appear in /sys/kernel/debug/tracing/available_filter_functions.

I tried using kprobe/fentry to attach to it, both failed.

>>
>> Signed-off-by: Florent Revest <revest@chromium.org>
>> ---
>>  kernel/trace/bpf_trace.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
>> index cbcd0d6fca7c..f6e301c775a5 100644
>> --- a/kernel/trace/bpf_trace.c
>> +++ b/kernel/trace/bpf_trace.c
>> @@ -922,6 +922,9 @@ BTF_ID(func, vfs_fallocate)
>>  BTF_ID(func, dentry_open)
>>  BTF_ID(func, vfs_getattr)
>>  BTF_ID(func, filp_close)
>> +#ifdef CONFIG_PERF_EVENTS
>> +BTF_ID(func, perf_event_mmap)
>> +#endif
>>  BTF_SET_END(btf_allowlist_d_path)
>>  
>>  static bool bpf_d_path_allowed(const struct bpf_prog *prog)
>> -- 
>> 2.33.0.1079.g6e70778dc9-goog
>>

--Hengqi

  reply	other threads:[~2021-10-29 15:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 16:43 [PATCH bpf-next] bpf: Allow bpf_d_path in perf_event_mmap Florent Revest
2021-10-28 22:46 ` Martin KaFai Lau
2021-10-29 15:17   ` Hengqi Chen [this message]
2021-10-29 17:08     ` Florent Revest
2021-10-29 17:02   ` Florent Revest
2021-11-01 13:17     ` Hengqi Chen
2021-11-01 15:01       ` Florent Revest
2021-11-01 17:31         ` Yonghong Song
2021-11-02  2:53           ` Alexei Starovoitov
2021-11-02  3:16             ` Andrii Nakryiko
2021-11-02  3:20               ` Alexei Starovoitov
2021-11-02  4:05                 ` Andrii Nakryiko
2021-11-02 23:03                   ` Florent Revest
2021-11-02 23:15                     ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10a745cc-5942-70ff-483f-a5c77a9776a2@gmail.com \
    --to=hengqi.chen@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jackmanb@google.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=revest@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).