Re: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 28, 2025 at 8:37 PM Rong Tao <rtoax@xxxxxxxxxxx> wrote:
>
> From: Rong Tao <rongtao@xxxxxxxx>
>
> 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.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux