Re: [PATCH bpf-next v3] selftests/bpf: Move test_dev_cgroup to prog_tests

2024-05-06 Thread Yonghong Song
On 5/3/24 6:55 AM, Muhammad Usama Anjum wrote: On 4/5/24 1:06 AM, Yonghong Song wrote: On 4/3/24 5:03 AM, Muhammad Usama Anjum wrote: On 4/3/24 7:36 AM, Yonghong Song wrote: On 4/2/24 8:16 AM, Muhammad Usama Anjum wrote: Yonghong Song, Thank you so much for replying. I was missing how

Re: [PATCH bpf-next 2/2] selftests/bpf: Free strdup memory in veristat

2024-04-29 Thread Yonghong Song
quot;free(input)" in parse_stats() to avoid memory leak in veristat.c. Signed-off-by: Geliang Tang Acked-by: Yonghong Song

Re: [PATCH bpf-next 1/2] selftests/bpf: Free strdup memory in test_sockmap

2024-04-29 Thread Yonghong Song
"free(ptr)" in check_whitelist() and check_blacklist() to avoid memory leaks in test_sockmap.c. Signed-off-by: Geliang Tang Acked-by: Yonghong Song

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-25 Thread Yonghong Song
On 4/24/24 7:42 PM, Xu Kuohai wrote: On 4/25/2024 6:06 AM, Yonghong Song wrote: On 4/23/24 7:25 PM, Xu Kuohai wrote: On 4/24/2024 5:55 AM, Yonghong Song wrote: On 4/20/24 1:33 AM, Xu Kuohai wrote: On 4/20/2024 7:00 AM, Eduard Zingerman wrote: On Thu, 2024-04-11 at 20:27 +0800, Xu Kuohai

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-24 Thread Yonghong Song
On 4/23/24 7:25 PM, Xu Kuohai wrote: On 4/24/2024 5:55 AM, Yonghong Song wrote: On 4/20/24 1:33 AM, Xu Kuohai wrote: On 4/20/2024 7:00 AM, Eduard Zingerman wrote: On Thu, 2024-04-11 at 20:27 +0800, Xu Kuohai wrote: From: Xu Kuohai With lsm return value check, the no-alu32 version

Re: [PATCH bpf-next v3 07/11] bpf: Fix a false rejection caused by AND operation

2024-04-23 Thread Yonghong Song
On 4/20/24 1:33 AM, Xu Kuohai wrote: On 4/20/2024 7:00 AM, Eduard Zingerman wrote: On Thu, 2024-04-11 at 20:27 +0800, Xu Kuohai wrote: From: Xu Kuohai With lsm return value check, the no-alu32 version test_libbpf_get_fd_by_id_opts is rejected by the verifier, and the log says:    0:

Re: [RFC PATCH bpf-next 0/3] bpf: freeze a task cgroup from bpf

2024-04-10 Thread Yonghong Song
On 4/9/24 8:32 AM, Michal Koutný wrote: Hi. On Tue, Apr 02, 2024 at 07:20:45PM +0100, Djalal Harouni wrote: Thanks yes, I would expect freeze to behave like signal, and if one wants to block immediately there is the LSM override return. The selftest attached tries to do exactly that. Are

Re: [PATCH net-next] selftests/bpf: eliminate warning of get_cgroup_id_from_path()

2024-04-08 Thread Yonghong Song
of the file calls it. Signed-off-by: Jason Xing But your change looks fine. Acked-by: Yonghong Song

Re: [PATCH bpf-next v3] selftests/bpf: Move test_dev_cgroup to prog_tests

2024-04-04 Thread Yonghong Song
On 4/3/24 5:03 AM, Muhammad Usama Anjum wrote: On 4/3/24 7:36 AM, Yonghong Song wrote: On 4/2/24 8:16 AM, Muhammad Usama Anjum wrote: Yonghong Song, Thank you so much for replying. I was missing how to run pipeline manually. Thanks a ton. On 4/1/24 11:53 PM, Yonghong Song wrote: On 4/1/24

Re: [PATCH bpf-next v3] selftests/bpf: Move test_dev_cgroup to prog_tests

2024-04-02 Thread Yonghong Song
On 4/2/24 8:16 AM, Muhammad Usama Anjum wrote: Yonghong Song, Thank you so much for replying. I was missing how to run pipeline manually. Thanks a ton. On 4/1/24 11:53 PM, Yonghong Song wrote: On 4/1/24 5:34 AM, Muhammad Usama Anjum wrote: Move test_dev_cgroup.c to prog_tests/dev_cgroup.c

Re: [PATCH bpf-next v3] selftests/bpf: Move test_dev_cgroup to prog_tests

2024-04-01 Thread Yonghong Song
On 4/1/24 5:34 AM, Muhammad Usama Anjum wrote: Move test_dev_cgroup.c to prog_tests/dev_cgroup.c to be able to run it with test_progs. Replace dev_cgroup.bpf.o with skel header file, dev_cgroup.skel.h and load program from it accourdingly. ./test_progs -t dev_cgroup mknod:

Re: [PATCH V2 bpf-next 1/2] bpf: add bpf_task_get_cgroup kfunc

2024-03-18 Thread Yonghong Song
Reviewed-by: Tycho Andersen Acked-by: Yonghong Song

Re: [PATCH bpf-next v2] bpf: Allow compiler to inline most of bpf_local_storage_lookup()

2024-02-08 Thread Yonghong Song
On 2/8/24 2:54 AM, Marco Elver wrote: On Thu, Feb 08, 2024 at 08:37AM +0100, Marco Elver wrote: On Thu, 8 Feb 2024 at 00:58, Yonghong Song wrote: On 2/7/24 4:26 AM, Marco Elver wrote: In various performance profiles of kernels with BPF programs attached, bpf_local_storage_lookup() appears

Re: [PATCH bpf-next v2] bpf: Allow compiler to inline most of bpf_local_storage_lookup()

2024-02-07 Thread Yonghong Song
On 2/7/24 4:26 AM, Marco Elver wrote: In various performance profiles of kernels with BPF programs attached, bpf_local_storage_lookup() appears as a significant portion of CPU cycles spent. To enable the compiler generate more optimal code, turn bpf_local_storage_lookup() into a static inline

Re: [PATCH] bpf: Separate bpf_local_storage_lookup() fast and slow paths

2024-01-31 Thread Yonghong Song
On 1/31/24 6:18 AM, Marco Elver wrote: To allow the compiler to inline the bpf_local_storage_lookup() fast- path, factor it out by making bpf_local_storage_lookup() a static inline function and move the slow-path to bpf_local_storage_lookup_slowpath(). Base on results from

Re: lsm_cgroup.c selftest fails to compile when CONFIG_PACKET!=y

2024-01-18 Thread Yonghong Song
On 1/18/24 8:05 AM, Eduard Zingerman wrote: On Thu, 2024-01-18 at 17:58 +0200, Eduard Zingerman wrote: [...] here is how config for x86 CI is prepared: ./scripts/kconfig/merge_config.sh \ ./tools/testing/selftests/bpf/config \ ./tools/testing/selftests/bpf/config.vm \

Re: [PATCH 1/3] selftests/bpf: Update LLVM Phabricator links

2024-01-10 Thread Yonghong Song
of fidelity in the relevant information. Additionally, fix a typo in the xdpwall.c print ("LLMV" -> "LLVM") while in the area. Link: https://discourse.llvm.org/t/update-on-github-pull-requests/71540/172 Signed-off-by: Nathan Chancellor Ack with one nit below. Acked-by:

Re: [PATCH bpf-next 0/2] bpf: add csum/ip_summed fields to __sk_buff

2024-01-02 Thread Yonghong Song
On 1/2/24 6:54 PM, Menglong Dong wrote: On Wed, Jan 3, 2024 at 8:52 AM Martin KaFai Lau wrote: On 1/2/24 10:11 AM, Stanislav Fomichev wrote: On 12/29, Menglong Dong wrote: For now, we have to call some helpers when we need to update the csum, such as bpf_l4_csum_replace,

Re: [PATCH v2 3/3] selftest/bpf: Test a perf bpf program that suppresses side effects.

2023-12-07 Thread Yonghong Song
On 12/7/23 5:08 PM, Kyle Huey wrote: On Thu, Dec 7, 2023 at 2:56 PM Kyle Huey wrote: On Thu, Dec 7, 2023 at 11:20 AM Marco Elver wrote: On Thu, 7 Dec 2023 at 20:12, Andrii Nakryiko wrote: On Thu, Dec 7, 2023 at 8:35 AM Kyle Huey wrote: The test sets a hardware breakpoint and uses a bpf

Re: [PATCH 2/2] selftest/bpf: Test returning zero from a perf bpf program suppresses SIGIO.

2023-12-05 Thread Yonghong Song
On 12/4/23 3:14 PM, Kyle Huey wrote: The test sets a hardware breakpoint and uses a bpf program to suppress the I/O availability signal if the ip matches the expected value. Signed-off-by: Kyle Huey --- .../selftests/bpf/prog_tests/perf_skip.c | 95 +++

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-27 Thread Yonghong Song
On 11/27/23 7:01 PM, Daniel Xu wrote: On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: On 11/27/23 12:44 AM, Yonghong Song wrote: On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/27/23 12:44 AM, Yonghong Song wrote: On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: [...] Tbh I'm not sure. This test passes with preserve_static_offset because it suppresses preserve_access_index. In general clang translates bitfield

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: [...] Tbh I'm not sure. This test passes with preserve_static_offset because it suppresses preserve_access_index. In general clang translates bitfield access to a set of IR statements like: C:

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/26/23 3:14 PM, Eduard Zingerman wrote: On Sat, 2023-11-25 at 20:22 -0800, Yonghong Song wrote: [...] --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c @@ -6,7 +6,10 @@ * modify it under the terms of version 2

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-25 Thread Yonghong Song
On 11/25/23 7:54 PM, Alexei Starovoitov wrote: On Sat, Nov 25, 2023 at 4:52 PM Yonghong Song wrote: diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c index 3065a716544d..ec7e04e012ae 100644 --- a/tools/testing/selftests

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-25 Thread Yonghong Song
On 11/22/23 1:20 PM, Daniel Xu wrote: Switching to vmlinux.h definitions seems to make the verifier very unhappy with bitfield accesses. The error is: ; md.u.md2.dir = direction; 33: (69) r1 = *(u16 *)(r2 +11) misaligned stack access off (0x0; 0x0)+-64+11 size 2 It looks like

Re: [PATCH ipsec-next v1 5/7] bpf: selftests: test_tunnel: Use vmlinux.h declarations

2023-11-25 Thread Yonghong Song
On 11/22/23 1:20 PM, Daniel Xu wrote: vmlinux.h declarations are more ergnomic, especially when working with kfuncs. The uapi headers are often incomplete for kfunc definitions. Co-developed-by: Antony Antony Signed-off-by: Antony Antony Signed-off-by: Daniel Xu ---

Re: [PATCH bpf-next v3 0/4] selftests/bpf: Update multiple prog_tests to use ASSERT_ macros

2023-11-20 Thread Yonghong Song
On 11/20/23 7:03 PM, Yuran Pereira wrote: Multiple files/programs in `tools/testing/selftests/bpf/prog_tests/` still heavily use the `CHECK` macro, even when better `ASSERT_` alternatives are available. As it was already pointed out by Yonghong Song [1] in the bpf selftests the use

Re: [PATCH bpf-next v2 1/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bpf_tcp_ca

2023-11-20 Thread Yonghong Song
On 11/20/23 12:15 PM, Yuran Pereira wrote: Hello Yonghong, On Mon, Nov 20, 2023 at 07:22:59AM -0800, Yonghong Song wrote: - if (CHECK(!err || errno != ENOENT, - "bpf_map_lookup_elem(sk_stg_map)", - "err:%d errno:%d

Re: [PATCH bpf-next v2 4/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in vmlinux

2023-11-20 Thread Yonghong Song
On 11/18/23 1:47 PM, Yuran Pereira wrote: vmlinux.c uses the `CHECK` calls even though the use of ASSERT_ series of macros is preferred in the bpf selftests. This patch replaces all `CHECK` calls for equivalent `ASSERT_` macro calls. Signed-off-by: Yuran Pereira Acked-by: Yonghong Song

Re: [PATCH bpf-next v2 3/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bpf_obj_id

2023-11-20 Thread Yonghong Song
On 11/18/23 1:45 PM, Yuran Pereira wrote: bpf_obj_id uses the `CHECK` calls even though the use of ASSERT_ series of macros is preferred in the bpf selftests. This patch replaces all `CHECK` calls for equivalent `ASSERT_` macro calls. Signed-off-by: Yuran Pereira Acked-by: Yonghong Song

Re: [PATCH bpf-next v2 2/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bind_perm

2023-11-20 Thread Yonghong Song
On 11/18/23 1:44 PM, Yuran Pereira wrote: bind_perm uses the `CHECK` calls even though the use of ASSERT_ series of macros is preferred in the bpf selftests. This patch replaces all `CHECK` calls for equivalent `ASSERT_` macro calls. Signed-off-by: Yuran Pereira Acked-by: Yonghong Song

Re: [PATCH bpf-next v2 1/4] selftests/bpf: Replaces the usage of CHECK calls for ASSERTs in bpf_tcp_ca

2023-11-20 Thread Yonghong Song
On 11/18/23 1:42 PM, Yuran Pereira wrote: bpf_tcp_ca uses the `CHECK` calls even though the use of ASSERT_ series of macros is preferred in the bpf selftests. This patch replaces all `CHECK` calls for equivalent `ASSERT_` macro calls. Signed-off-by: Yuran Pereira ---

Re: [PATCH bpf-next v3 2/2] selftests/bpf: Add malloc failure checks in bpf_iter

2023-10-29 Thread Yonghong Song
-by: Yonghong Song

Re: [PATCH bpf-next v3 1/2] selftests/bpf: Convert CHECK macros to ASSERT_* macros in bpf_iter

2023-10-29 Thread Yonghong Song
On 10/27/23 10:24 PM, Yuran Pereira wrote: As it was pointed out by Yonghong Song [1], in the bpf selftests the use of the ASSERT_* series of macros is preferred over the CHECK macro. This patch replaces all CHECK calls in bpf_iter with the appropriate ASSERT_* macros. [1] https

Re: [PATCH bpf-next v2 1/2] selftests/bpf: Convert CHECK macros to ASSERT_* macros in bpf_iter

2023-10-26 Thread Yonghong Song
On 10/25/23 9:33 PM, Kui-Feng Lee wrote: On 10/25/23 19:03, Yuran Pereira wrote: As it was pointed out by Yonghong Song [1], in the bpf selftests the use of the ASSERT_* series of macros is preferred over the CHECK macro. This patch replaces all CHECK calls in bpf_iter with the appropriate

Re: [PATCH bpf-next v2 2/2] selftests/bpf: Add malloc failure checks in bpf_iter

2023-10-26 Thread Yonghong Song
-by: Yonghong Song

Re: [PATCH bpf-next] selftests/bpf: Convert CHECK macros to ASSERT_* macros in bpf_iter

2023-10-24 Thread Yonghong Song
On 10/24/23 3:43 PM, Yuran Pereira wrote: As it was pointed out by Yonghong Song [1], in the bpf selftests the use of the ASSERT_* series of macros is preferred over the CHECK macro. This patch replaces all CHECK calls in bpf_iter with the appropriate ASSERT_* macros. [1] https

Re: [PATCH bpf-next] selftests/bpf: Add malloc failure checks in bpf_iter

2023-10-24 Thread Yonghong Song
On 10/24/23 7:28 PM, Kui-Feng Lee wrote: Thank you for the patches. I found you have two patches in this set. You can generate both patch at once with git format-patch. format-patch will give each patch a number in their order. For example, the subject of this message will be   [PATCH

Re: [PATCH] selftests: bpf: add malloc failures checks in bpf_iter

2023-10-23 Thread Yonghong Song
On 10/23/23 7:59 PM, Yuran Pereira wrote: Since some malloc calls in bpf_iter may at times fail, this patch adds the appropriate fail checks, and ensures that any previously allocated resource is appropriately destroyed before returning the function. Signed-off-by: Yuran Pereira ---