Re: [PATCH v1 bpf-next 00/17] Retire progs/test_sock_addr.c

2024-05-10 Thread Andrii Nakryiko
On Fri, May 10, 2024 at 3:13 PM Jordan Rife wrote: > > Andrii, > > It looks like the PR bot dropped one of the commits from the patch > series which is why it didn't build. > > > selftests/bpf: Handle ATTACH_REJECT test cases > > Is there any way to get it to recreate the PR with all 17 patches?

Re: [PATCH v1 bpf-next 00/17] Retire progs/test_sock_addr.c

2024-05-10 Thread Andrii Nakryiko
On Fri, May 10, 2024 at 12:08 PM Jordan Rife wrote: > > This patch series migrates remaining tests from bpf/test_sock_addr.c to > prog_tests/sock_addr.c and progs/verifier_sock_addr.c in order to fully > retire the old-style test program and expands test coverage to test > previously untested

Re: [PATCH][next] selftests/bpf: Fix spelling mistake "{GET|SET}SOCKOP" -> "{GET|SET}SOCKOPT"

2024-05-07 Thread Andrii Nakryiko
On Wed, May 1, 2024 at 4:21 AM Colin Ian King wrote: > > There are two spelling mistakes in .descr literal strings. Fix them. > > Signed-off-by: Colin Ian King > --- > tools/testing/selftests/bpf/prog_tests/sockopt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > This doesn't

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

2024-04-29 Thread Andrii Nakryiko
On Sun, Apr 28, 2024 at 8:15 AM Xu Kuohai wrote: > > On 4/27/2024 4:36 AM, Andrii Nakryiko wrote: > > On Tue, Apr 23, 2024 at 7:26 PM Xu Kuohai wrote: > >> > >> On 4/24/2024 5:55 AM, Yonghong Song wrote: > >>> > >>> On 4/20/24 1:33 AM

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

2024-04-26 Thread Andrii Nakryiko
On Tue, Apr 23, 2024 at 7:26 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

Re: [PATCH bpf-next v3 06/11] bpf: Fix compare error in function retval_range_within

2024-04-25 Thread Andrii Nakryiko
On Thu, Apr 11, 2024 at 5:24 AM Xu Kuohai wrote: > > From: Xu Kuohai > > After checking lsm hook return range in verifier, the test case > "test_progs -t test_lsm" failed, and the failure log says: > > libbpf: prog 'test_int_hook': BPF program load failed: Invalid argument > libbpf: prog

Re: [PATCH v3] selftests/bpf: Add ring_buffer__consume_n test.

2024-04-25 Thread Andrii Nakryiko
On Thu, Apr 25, 2024 at 7:06 AM Andrea Righi wrote: > > Add a testcase for the ring_buffer__consume_n() API. > > The test produces multiple samples in a ring buffer, using a > sys_getpid() fentry prog, and consumes them from user-space in batches, > rather than consuming all of them greedily,

Re: [PATCH bpf-next v2 12/16] selftests/bpf: wq: add bpf_wq_init() checks

2024-04-24 Thread Andrii Nakryiko
On Sat, Apr 20, 2024 at 2:10 AM Benjamin Tissoires wrote: > > Allows to test if allocation/free works > > Signed-off-by: Benjamin Tissoires > > --- > > changes in v2: > - dropped mark_precise checks > --- > tools/testing/selftests/bpf/bpf_experimental.h | 1 + >

Re: [PATCH v4 4/4] selftests/bpf: Add tests for ring__consume_n and ring_buffer__consume_n

2024-04-06 Thread Andrii Nakryiko
On Sat, Apr 6, 2024 at 10:39 AM Andrii Nakryiko wrote: > > On Sat, Apr 6, 2024 at 2:20 AM Andrea Righi > wrote: > > > > Add tests for new API ring__consume_n() and ring_buffer__consume_n(). > > > > Signed-off-by: Andrea Righi > > --- > > tools/t

Re: [PATCH v4 2/4] libbpf: ringbuf: allow to consume up to a certain amount of items

2024-04-06 Thread Andrii Nakryiko
On Sat, Apr 6, 2024 at 2:20 AM Andrea Righi wrote: > > In some cases, instead of always consuming all items from ring buffers > in a greedy way, we may want to consume up to a certain amount of items, > for example when we need to copy items from the BPF ring buffer to a > limited user buffer. >

Re: [PATCH v4 4/4] selftests/bpf: Add tests for ring__consume_n and ring_buffer__consume_n

2024-04-06 Thread Andrii Nakryiko
On Sat, Apr 6, 2024 at 2:20 AM Andrea Righi wrote: > > Add tests for new API ring__consume_n() and ring_buffer__consume_n(). > > Signed-off-by: Andrea Righi > --- > tools/testing/selftests/bpf/prog_tests/ringbuf.c | 8 > 1 file changed, 8 insertions(+) > > diff --git

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-30 Thread Andrii Nakryiko
On Sat, Mar 30, 2024 at 10:52 AM Jiri Olsa wrote: > > On Sat, Mar 30, 2024 at 08:27:55AM -0400, Steven Rostedt wrote: > > On Fri, 29 Mar 2024 16:28:33 -0700 > > Andrii Nakryiko wrote: > > > > > I thought I'll just ask instead of digging through code, sorry for

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-29 Thread Andrii Nakryiko
On Thu, Mar 28, 2024 at 8:10 AM Steven Rostedt wrote: > > On Thu, 28 Mar 2024 22:43:46 +0800 > 梦龙董 wrote: > > > I have done a simple benchmark on creating 1000 > > trampolines. It is slow, quite slow, which consume up to > > 60s. We can't do it this way. > > > > Now, I have a bad idea. How about

Re: [PATCH v1 bpf-next 1/8] selftests/bpf: Introduce sock_addr_testmod

2024-03-29 Thread Andrii Nakryiko
On Fri, Mar 29, 2024 at 12:20 PM Jordan Rife wrote: > > sock_addr_testmod provides a mechanism for the sock_addr_kern prog_test > to drive socket operations in kernel space. On init, one of the > following socket operations is performed based on the module parameters: > kernel_bind(),

Re: [PATCH v1 02/13] libbpf: Make __printf define conditional

2024-03-11 Thread Andrii Nakryiko
On Mon, Mar 11, 2024 at 11:54 AM Ian Rogers wrote: > > On Mon, Mar 11, 2024 at 10:49 AM Andrii Nakryiko > wrote: > > > > On Sat, Mar 9, 2024 at 6:05 PM Ian Rogers wrote: > > > > > > libbpf depends upon linux/err.h which has a linux/compiler.h > > >

Re: [PATCH v1 02/13] libbpf: Make __printf define conditional

2024-03-11 Thread Andrii Nakryiko
nostic ignored "-Wformat-nonliteral" > > -#define __printf(a, b) __attribute__((format(printf, a, b))) > +#ifndef __printf > +# define __printf(a, b)__attribute__((format(printf, a, b))) styling nit: don't add spaces between # and define, please overall LGTM Acked-by: Andr

Re: [PATCH bpf-next v4 2/3] selftests/bpf: Make install target copy test_progs extra files

2024-01-29 Thread Andrii Nakryiko
On Sun, Jan 28, 2024 at 11:09 PM Björn Töpel wrote: > > From: Björn Töpel > > Currently, "make install" does not install the required test_progs > "extra files" (e.g. kernel modules, helper shell scripts, etc.) for > the BPF machine flavors (e.g. cpuv4). > > Add the missing "extra files"

Re: [PATCH bpf-next v2] selftests/bpf: Include runner extras for install target

2024-01-26 Thread Andrii Nakryiko
On Thu, Jan 25, 2024 at 8:05 AM Björn Töpel wrote: > > From: Björn Töpel > > When using the "install" or targets depending on install, e.g. > "gen_tar", the "runner extras" weren't included for the BPF machine > flavors. > > Make sure the necessary helper scripts/tools are added to >

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

2024-01-19 Thread Andrii Nakryiko
On Fri, Jan 19, 2024 at 3:13 PM Vincent Li wrote: > > On Fri, Jan 19, 2024 at 2:26 PM Alexei Starovoitov > wrote: > > > > On Fri, Jan 19, 2024 at 7:00 AM Vincent Li wrote: > > > > > > On Fri, Jan 19, 2024 at 4:23 AM Eduard Zingerman > > > wrote: > > > > > > > > On Fri, 2024-01-19 at 16:04

Re: [PATCH bpf-next v2 14/15] bpf: Optimize state pruning for spilled scalars

2024-01-10 Thread Andrii Nakryiko
On Wed, Jan 10, 2024 at 1:04 PM Eduard Zingerman wrote: > > On Tue, 2024-01-09 at 16:22 -0800, Andrii Nakryiko wrote: > [...] > > > static bool stacksafe(struct bpf_verifier_env *env, struct > > > bpf_func_state *old, > > > struct b

Re: [PATCH bpf-next v2 15/15] selftests/bpf: states pruning checks for scalar vs STACK_{MISC,ZERO}

2024-01-09 Thread Andrii Nakryiko
On Mon, Jan 8, 2024 at 12:53 PM Maxim Mikityanskiy wrote: > > From: Eduard Zingerman > > Check that stacksafe() considers the following old vs cur stack spill > state combinations equivalent: > - spill of unbound scalar vs combination of STACK_{MISC,ZERO,INVALID} > - STACK_MISC vs spill of

Re: [PATCH bpf-next v2 14/15] bpf: Optimize state pruning for spilled scalars

2024-01-09 Thread Andrii Nakryiko
On Mon, Jan 8, 2024 at 12:53 PM Maxim Mikityanskiy wrote: > > From: Eduard Zingerman > > Changes for scalar ID tracking of spilled unbound scalars lead to > certain verification performance regression. This commit mitigates the > regression by exploiting the following properties maintained by >

Re: [PATCH bpf-next v2 13/15] selftests/bpf: Add test cases for narrowing fill

2024-01-09 Thread Andrii Nakryiko
On Mon, Jan 8, 2024 at 12:53 PM Maxim Mikityanskiy wrote: > > From: Maxim Mikityanskiy > > The previous commit allowed to preserve boundaries and track IDs of > scalars on narrowing fills. Add test cases for that pattern. > > Signed-off-by: Maxim Mikityanskiy > Acked-by: Eduard Zingerman > ---

Re: [PATCH bpf-next v2 12/15] bpf: Preserve boundaries and track scalars on narrowing fill

2024-01-09 Thread Andrii Nakryiko
On Mon, Jan 8, 2024 at 12:53 PM Maxim Mikityanskiy wrote: > > From: Maxim Mikityanskiy > > When the width of a fill is smaller than the width of the preceding > spill, the information about scalar boundaries can still be preserved, > as long as it's coerced to the right width (done by

Re: [PATCH bpf-next v2 09/15] selftests/bpf: Test assigning ID to scalars on spill

2024-01-09 Thread Andrii Nakryiko
On Mon, Jan 8, 2024 at 12:53 PM Maxim Mikityanskiy wrote: > > From: Maxim Mikityanskiy > > The previous commit implemented assigning IDs to registers holding > scalars before spill. Add the test cases to check the new functionality. > > Signed-off-by: Maxim Mikityanskiy > Acked-by: Eduard

Re: [PATCH bpf-next v5 4/4] selftests/bpf: add testcase to verifier_bounds.c for BPF_JNE

2023-12-19 Thread Andrii Nakryiko
t; Signed-off-by: Menglong Dong > --- > v5: > - add some comments to the function that we add > - add reg_not_equal_const() > --- > .../selftests/bpf/progs/verifier_bounds.c | 62 +++ > 1 file changed, 62 insertions(+) > LGTM Acked-by: Andri

Re: [PATCH bpf-next v5 3/4] selftests/bpf: activate the OP_NE logic in range_cond()

2023-12-19 Thread Andrii Nakryiko
-j > Summary: 65/18959832 PASSED, 0 SKIPPED, 0 FAILED > Thanks for running SLOW_TESTS=1 mode as well! Acked-by: Andrii Nakryiko > Signed-off-by: Menglong Dong > --- > v5: > - add "{U32, U32, {0, U32_MAX}, {U32_MAX, U32_MAX}}" > v4: > - remove reduplicated s32 casting

Re: [PATCH bpf-next v5 2/4] selftests/bpf: remove reduplicated s32 casting in "crafted_cases"

2023-12-19 Thread Andrii Nakryiko
1 file changed, 4 insertions(+), 4 deletions(-) > Acked-by: Andrii Nakryiko > diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c > index 0c9abd279e18..3bf4ddd720a8 100644 > --- a/tools/testing/selftests/bpf/prog_tests

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

2023-12-07 Thread Andrii Nakryiko
On Thu, Dec 7, 2023 at 8:35 AM Kyle Huey wrote: > > The test sets a hardware breakpoint and uses a bpf program to suppress the > side effects of a perf event sample, including I/O availability signals, > SIGTRAPs, and decrementing the event counter limit, if the ip matches the > expected value.

Re: [PATCH bpf-next v4 06/10] libbpf: selftests: Add verifier tests for CO-RE bitfield writes

2023-12-04 Thread Andrii Nakryiko
ised. > > Acked-by: Andrii Nakryiko > Signed-off-by: Daniel Xu > --- nit: please drop "libbpf: " prefix from the patch subject, this is "selftests/bpf: " actually > .../selftests/bpf/prog_tests/verifier.c | 2 + > .../bpf/progs/verifier_bitfield_write.c

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

2023-12-04 Thread Andrii Nakryiko
On Mon, Dec 4, 2023 at 12: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 v3 5/9] libbpf: selftests: Add verifier tests for CO-RE bitfield writes

2023-12-01 Thread Andrii Nakryiko
field_write.c > LGTM, but I'm not sure why we need all those __failure_unpriv, see below. Regardless: Acked-by: Andrii Nakryiko > diff --git a/tools/testing/selftests/bpf/prog_tests/verifier.c > b/tools/testing/selftests/bpf/prog_tests/verifier.c > index 5cfa7a6316b6..67b4948865a3 10

Re: [PATCH ipsec-next v3 4/9] bpf: selftests: test_loader: Support __btf_path() annotation

2023-12-01 Thread Andrii Nakryiko
ting/selftests/bpf/progs/bpf_misc.h | 1 + > tools/testing/selftests/bpf/test_loader.c| 7 +++ > 2 files changed, 8 insertions(+) > Acked-by: Andrii Nakryiko > diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h > b/tools/testing/selftests/bpf/progs/bpf_misc.h &g

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

2023-11-28 Thread Andrii Nakryiko
On Mon, Nov 27, 2023 at 8:06 PM Yonghong Song wrote: > > > 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

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

2023-11-17 Thread Andrii Nakryiko
On Wed, Nov 15, 2023 at 10:14 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

Re: [RFC bpf-next 5/6] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-10-31 Thread Andrii Nakryiko
On Sun, Oct 29, 2023 at 4:22 PM Daniel Xu wrote: > > On Fri, Oct 27, 2023 at 01:33:09PM -0700, Andrii Nakryiko wrote: > > On Fri, Oct 27, 2023 at 11:46 AM Daniel Xu wrote: > > > > > > Switching to vmlinux.h definitions seems to make the verifier very > &

Re: [RFC bpf-next 5/6] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-10-27 Thread Andrii Nakryiko
On Fri, Oct 27, 2023 at 11:46 AM 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

Re: [PATCH] Incorrect backtracking for load/store or atomic ops

2023-10-21 Thread Andrii Nakryiko
On Fri, Oct 20, 2023 at 9:06 AM Tao Lyu wrote: > > Hi, > > I found the backtracking logic of the eBPF verifier is flawed > when meeting 1) normal load and store instruction or > 2) atomic memory instructions. > > # Normal load and store > > Here, I show one case about the normal load and store

Re: [PATCH] selftests: bpf: remove unused variables

2023-10-12 Thread Andrii Nakryiko
On Thu, Oct 12, 2023 at 6:35 PM zhujun2 wrote: > > These variables are never referenced in the code, just remove them. > > Signed-off-by: zhujun2 > --- Why do you stubbornly keep submitting the same untested and broken patch, ignoring the feedback ([0])? Your changes don't even compile