[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10a745cc-5942-70ff-483f-a5c77a9776a2@gmail.com>
Date: Fri, 29 Oct 2021 23:17:41 +0800
From: Hengqi Chen <hengqi.chen@...il.com>
To: Martin KaFai Lau <kafai@...com>,
Florent Revest <revest@...omium.org>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, kpsingh@...nel.org, jackmanb@...gle.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Allow bpf_d_path in perf_event_mmap
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@...omium.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
Powered by blists - more mailing lists