[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9642ad1d-e227-417e-a9ff-b69b2cb2d0d9@linux.dev>
Date: Thu, 18 Jul 2024 10:16:54 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Lin Yikai <yikai.lin@...o.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Matt Bobrowski <mattbobrowski@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu
<mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
opensource.kernel@...o.com
Subject: Re: [PATCH bpf-next v1 0/3] add bpf_file_d_path helper and selftests
On 7/18/24 4:51 AM, Lin Yikai wrote:
> v1:
> - patch 2:
> - [1/2] add bpf_file_d_path helper
> - [2/2] add selftest to it
>
> Hi, we are looking to add the "bpf_file_d_path" helper,
> used to retrieve the path from a struct file object.
> bpf_file_d_path(void *file, char *dst, u32 size);
>
> It's worth noting that the "file" parameter is defined as "void*" type.
>
> * Our problems *
> Previously, we encountered issues
> on some user-space operating systems(OS):
>
> 1.Difficulty using vmlinux.h
> (1) The OS lacks support for bpftool.
> We can not use:
> "bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h".
> Bpftool need a separate complex cross-compilation environment to build.
>
> (2) Many duplicate definitions between OS and vmlinux.h.
>
> (3) The vmlinux.h size is large (2.8MB on arm64/Android),
> causing increased ebpf prog size and user space consumption.
The compiled bpf prog size is increased by 2.8MB because it included vmlinux.h?
>
> 2.The "struct file" has many internal variables and definitions,
> and maybe change along with Linux version iterations,
> making it hard to copy it to OS.
If vmlinux.h is not convenience in your use case, you can try to define "struct
file" with __attribute__((preserve_access_index)) and the libbpf will adjust the
bpf prog against the running kernel.
There was a discussion a year ago about bpf helpers freeze. No new helper can be
added since then. The same goes for this one.
pw-bot: cr
Powered by blists - more mailing lists