[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+hUk2wV3M+9mgv_i5sNt_FuHpAnDpkQJ22D37bxAJHsQ@mail.gmail.com>
Date: Wed, 28 May 2025 22:44:48 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Rong Tao <rtoax@...mail.com>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, rongtao@...tc.cn,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
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>, Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Juntong Deng <juntong.deng@...look.com>, Amery Hung <amery.hung@...edance.com>,
Dave Marchevsky <davemarchevsky@...com>, Hou Tao <houtao1@...wei.com>,
"open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)" <bpf@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
On Wed, May 28, 2025 at 8:37 PM Rong Tao <rtoax@...mail.com> wrote:
>
> From: Rong Tao <rongtao@...tc.cn>
>
> It is a bit troublesome to get cwd based on pid in bpf program, such as
> bpftrace example [1].
>
> This patch therefore adds a new bpf_task_cwd_from_pid() kfunc which
> allows BPF programs to get cwd from a pid.
>
> [1] https://github.com/bpftrace/bpftrace/issues/3314
Yes. This is cumbersome, but adding a very specific kfunc
to the kernel is not a solution.
This is tracing, no need for precise cwd. probe_read_kernel
can do the job. bpftrace needs to have better C interop.
Once that happens any kind of tracing extraction will be
easy to write in C. Like this bpf_task_cwd_from_pid()
can already be written as C bpf program.
Powered by blists - more mailing lists