[PATCH bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage

2025-06-05 Thread Rong Tao
From: Rong Tao Within __add_three() function, should use function parameters instead of global variables. So that the variables groot_nested.inner.root and groot_nested.inner.glock in rbtree_add_nodes_nested() are tested correctly. Signed-off-by: Rong Tao --- tools/testing/selftests/bpf/progs

Re: [PATCH bpf-next] selftests/bpf: Fix compile error of bin_attribute::read/write()

2025-06-04 Thread Rong Tao
On 6/4/25 16:53, Jiri Olsa wrote: On Wed, Jun 04, 2025 at 01:53:22PM +0800, Rong Tao wrote: From: Rong Tao Since commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()"), make bin_attribute parameter of bin_attribute::read/write() const. h

[PATCH bpf-next] selftests/bpf: Fix compile error of bin_attribute::read/write()

2025-06-03 Thread Rong Tao
From: Rong Tao Since commit 97d06802d10a ("sysfs: constify bin_attribute argument of bin_attribute::read/write()"), make bin_attribute parameter of bin_attribute::read/write() const. Signed-off-by: Rong Tao --- tools/testing/selftests/bpf/test_kmods/bpf_testmod.c | 6 +++--- 1 file

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

2025-05-29 Thread Rong Tao
On 5/30/25 09:55, Yonghong Song wrote: On 5/29/25 6:28 PM, Rong Tao wrote: On 5/29/25 13:44, Alexei Starovoitov wrote: On Wed, May 28, 2025 at 8:37 PM Rong Tao wrote: From: Rong Tao It is a bit troublesome to get cwd based on pid in bpf program, such as bpftrace example [1]. This

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

2025-05-29 Thread Rong Tao
On 5/29/25 13:44, Alexei Starovoitov wrote: On Wed, May 28, 2025 at 8:37 PM Rong Tao wrote: From: Rong Tao 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

[PATCH bpf-next 2/2] selftests/bpf: Add selftests for bpf_task_cwd_from_pid()

2025-05-28 Thread Rong Tao
From: Rong Tao Add some selftest testcases that validate the expected behavior of the bpf_task_cwd_from_pid() kfunc that was added in the prior patch. Signed-off-by: Rong Tao --- .../selftests/bpf/prog_tests/task_kfunc.c | 3 ++ .../selftests/bpf/progs/task_kfunc_common.h | 1

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

2025-05-28 Thread Rong Tao
From: Rong Tao 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 Signed-off-by: Rong

[PATCH bpf-next 0/2] Add kfunc for doing pid -> task cwd

2025-05-28 Thread Rong Tao
In some application like bpftrace [1], need to get the cwd from the pid. This patch provides a new kfunc that can get the cwd of the process from the pid. [1] https://github.com/bpftrace/bpftrace/issues/3314 Rong Tao (2): bpf: Add bpf_task_cwd_from_pid() kfunc selftests/bpf: Add selftests