Re: [PATCH bpf-next] bpf: handle implicit declaration of function gettid in bpf_iter.c

2024-10-28 Thread Andrii Nakryiko
On Sun, Oct 27, 2024 at 8:41 PM Jason Xing wrote: > > From: Jason Xing > > As we can see from the title, when I compiled the selftests/bpf, I > saw the error: > implicit declaration of function ‘gettid’ ; did you mean ‘getgid’? > [-Werror=implicit-function-declaration] > skel->bss->tid = getti

Re: [PATCH bpf-next v6 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-27 Thread Andrii Nakryiko
On Mon, Sep 16, 2024 at 1:38 AM Tony Ambardar wrote: > > Support for handling BTF data of either endianness was added in [1], but > did not include BTF.ext data for lack of use cases. Later, support for > static linking [2] provided a use case, but this feature and later ones > were restricted to

Re: [PATCH] selftests/bpf: Add valid flag to bpf_cookie selftest's res

2024-09-06 Thread Andrii Nakryiko
On Thu, Sep 5, 2024 at 11:55 PM Yuan Chen wrote: > > What you said is reasonable,but it would confuse the test personnel, as there > is > no clear reminders. Is it possible to modify it to without SKIP,will give > exact > reminders when it is failed? > You'll get a test failure, I don't think w

Re: [PATCH] selftests/bpf: Add valid flag to bpf_cookie selftest's res

2024-09-05 Thread Andrii Nakryiko
On Wed, Sep 4, 2024 at 9:10 PM Yuan Chen wrote: > > From: Yuan Chen > > This patch identifies whether a test item is valid by adding a valid flag to > res. > > When we test the bpf_cookies/perf_event sub-test item of test_progs, there is > a > probability failure of the test item. In fact, this

Re: [PATCH bpf-next v4 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-04 Thread Andrii Nakryiko
On Mon, Sep 2, 2024 at 1:19 AM Tony Ambardar wrote: > > On Fri, Aug 30, 2024 at 02:14:19PM -0700, Andrii Nakryiko wrote: > > On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar > > wrote: > > > > > > Support for handling BTF data of either endianness was add

Re: [PATCH bpf-next v5 6/8] libbpf: Support linking bpf objects of either endianness

2024-09-04 Thread Andrii Nakryiko
On Tue, Sep 3, 2024 at 12:34 AM Tony Ambardar wrote: > > Allow static linking object files of either endianness, checking that input > files have consistent byte-order, and setting output endianness from input. > > Linking requires in-memory processing of programs, relocations, sections, > etc. in

Re: [PATCH bpf-next v5 5/8] libbpf: Support opening bpf objects of either endianness

2024-09-04 Thread Andrii Nakryiko
On Tue, Sep 3, 2024 at 12:33 AM Tony Ambardar wrote: > > Allow bpf_object__open() to access files of either endianness, and convert > included BPF programs to native byte-order in-memory for introspection. > Loading BPF objects of non-native byte-order is still disallowed however. > > Signed-off-b

Re: [PATCH bpf-next v5 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-04 Thread Andrii Nakryiko
On Tue, Sep 3, 2024 at 12:33 AM Tony Ambardar wrote: > > Support for handling BTF data of either endianness was added in [1], but > did not include BTF.ext data for lack of use cases. Later, support for > static linking [2] provided a use case, but this feature and later ones > were restricted to

Re: [PATCH bpf-next v4 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-30 Thread Andrii Nakryiko
On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar wrote: > > Track target endianness in 'struct bpf_gen' and process in-memory data in > native byte-order, but on finalization convert the embedded loader BPF > insns to target endianness. > > The light skeleton also includes a target-accessed data blo

Re: [PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-30 Thread Andrii Nakryiko
On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar wrote: > > Allow bpf_object__open() to access files of either endianness, and convert > included BPF programs to native byte-order in-memory for introspection. > Loading BPF objects of non-native byte-order is still disallowed however. > > Signed-off-

Re: [PATCH bpf-next v4 6/8] libbpf: Support linking bpf objects of either endianness

2024-08-30 Thread Andrii Nakryiko
On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar wrote: > > Allow static linking object files of either endianness, checking that input > files have consistent byte-order, and setting output endianness from input. > > Linking requires in-memory processing of programs, relocations, sections, > etc. i

Re: [PATCH bpf-next v4 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-30 Thread Andrii Nakryiko
On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar wrote: > > Support for handling BTF data of either endianness was added in [1], but > did not include BTF.ext data for lack of use cases. Later, support for > static linking [2] provided a use case, but this feature and later ones > were restricted to

Re: [PATCH bpf-next v1 2/2] selftests/bpf: Fix cross-compile issue for some files and a static compile issue for "-lzstd"

2024-08-27 Thread Andrii Nakryiko
On Tue, Aug 27, 2024 at 6:40 AM Lin Yikai wrote: > > 1. Fix cross-compile issue for some files: > [Issue] > When cross-compiling bpf selftests for arm64 on x86_64 host, the following > error occurs: > progs/loop2.c:20:7: error: incomplete definition of type 'struct user_pt_regs' >20 |

Re: [PATCH bpf-next v2 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-26 Thread Andrii Nakryiko
On Mon, Aug 26, 2024 at 3:53 AM Tony Ambardar wrote: > > On Fri, Aug 23, 2024 at 12:47:47PM -0700, Andrii Nakryiko wrote: > > On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar > > wrote: > > > > > > From: Tony Ambardar > > > > > > Allow bpf_ob

Re: [PATCH bpf-next v2 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-26 Thread Andrii Nakryiko
On Mon, Aug 26, 2024 at 3:58 AM Tony Ambardar wrote: > > On Fri, Aug 23, 2024 at 12:47:56PM -0700, Andrii Nakryiko wrote: > > On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar > > wrote: > > > > > > From: Tony Ambardar > > > > > > Track targe

Re: [PATCH bpf-next v2 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-23 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Track target endianness in 'struct bpf_gen' and process in-memory data in > native byte-order, but on finalization convert the embedded loader BPF > insns to target endianness. > > The light skeleton also includes a

Re: [PATCH bpf-next v2 6/8] libbpf: Support linking bpf objects of either endianness

2024-08-23 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Allow static linking object files of either endianness, checking that input > files have consistent byte-order, and setting output endianness from input. > > Linking requires in-memory processing of programs, relocat

Re: [PATCH bpf-next v2 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-23 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Allow bpf_object__open() to access files of either endianness, and convert > included BPF programs to native byte-order in-memory for introspection. > > Signed-off-by: Tony Ambardar > --- > tools/lib/bpf/libbpf.c

Re: [PATCH bpf-next v2 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-23 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 4:36 PM Andrii Nakryiko wrote: > > I ran out of time looking through this, I'll try to get back to this > patch set later today or tomorrow. So please don't repost, but see my > comments below. > > On Thu, Aug 22, 2024 at 2:25 AM Tony Ambarda

Re: [PATCH bpf-next v2 1/8] libbpf: Improve log message formatting

2024-08-22 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 2:24 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Fix missing newlines and extraneous terminal spaces in messages. > > Signed-off-by: Tony Ambardar > --- > tools/lib/bpf/btf.c | 7 --- > tools/lib/bpf/btf_dump.c | 2 +- > tools/lib/bpf/btf_relocat

Re: [PATCH bpf-next v2 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-22 Thread Andrii Nakryiko
I ran out of time looking through this, I'll try to get back to this patch set later today or tomorrow. So please don't repost, but see my comments below. On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Support for handling BTF data of either endianness was added

Re: [bpf-next 0/3] samples/bpf: Remove obsolete tracing-related tests

2024-08-12 Thread Andrii Nakryiko
On Sun, Aug 11, 2024 at 5:45 PM Daniel T. Lee wrote: > > The BPF tracing infrastructure has undergone significant evolution, > leading to the introduction of more robust and efficient APIs. > However, some of the existing tests in the samples/bpf directory have > not kept pace with these developme

Re: [bug report] selftests/bpf: BPF register range bounds tester

2024-08-09 Thread Andrii Nakryiko
On Fri, Aug 9, 2024 at 4:23 AM Dan Carpenter wrote: > > Hello Andrii Nakryiko, > > This is a semi-automatic email about new static checker warnings. > > Commit 8863238993e2 ("selftests/bpf: BPF register range bounds > tester") from Nov 11, 2023, leads to

Re: [bug report] selftests/bpf: add trusted global subprog arg tests

2024-08-09 Thread Andrii Nakryiko
On Fri, Aug 9, 2024 at 4:32 AM Dan Carpenter wrote: > > Hello Andrii Nakryiko, > > This is a semi-automatic email about new static checker warnings. > > Commit c381203eadb7 ("selftests/bpf: add trusted global subprog arg > tests") from Jan 29, 2024, leads to

Re: [PATCH bpf-next v1 6/8] selftests/bpf: Fix compile if backtrace support missing in libc

2024-07-29 Thread Andrii Nakryiko
On Fri, Jul 26, 2024 at 8:48 PM Tony Ambardar wrote: > > On Thu, Jul 25, 2024 at 01:22:37PM -0700, Andrii Nakryiko wrote: > > On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar > > wrote: > > > > > > From: Tony Ambardar > > > > > > Use backtrace

Re: [PATCH bpf-next v1 7/8] selftests/bpf: Fix using stdout, stderr as struct field names

2024-07-25 Thread Andrii Nakryiko
On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Typically stdin, stdout, stderr are treated as reserved identifiers under > ISO/ANSI C, and a libc implementation is free to define these as macros. Ok, wow that. Do you have a pointer to where in the standard it is

Re: [PATCH bpf-next v1 6/8] selftests/bpf: Fix compile if backtrace support missing in libc

2024-07-25 Thread Andrii Nakryiko
On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Use backtrace functions only with glibc and otherwise provide stubs in > test_progs.c. This avoids compile errors (e.g. with musl libc) like: > > test_progs.c:13:10: fatal error: execinfo.h: No such file or directo

Re: [PATCH bpf-next v1 5/8] selftests/bpf: Fix order-of-include compile errors in lwt_reroute.c

2024-07-25 Thread Andrii Nakryiko
On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Fix redefinition errors seen compiling lwt_reroute.c for mips64el/musl-libc > by adjusting the order of includes in lwt_helpers.h. The ordering required > is: > --> (from "test_progs.h") --> . > > Because of th

Re: [PATCH bpf-next v1 2/8] selftests/bpf: Fix arg parsing in veristat, test_progs

2024-07-25 Thread Andrii Nakryiko
On Thu, Jul 25, 2024 at 3:39 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Current code parses arguments with strtok_r() using a construct like > > char *state = NULL; > while ((next = strtok_r(state ? NULL : input, ",", &state))) { > ... > } > > where logic assumes the

Re: [PATCH bpf-next v1 00/19] selftests/bpf: Improve libc portability / musl support (part 1)

2024-07-24 Thread Andrii Nakryiko
On Wed, Jul 24, 2024 at 5:28 PM Tony Ambardar wrote: > > Hi Andrii, > > On Wed, Jul 24, 2024 at 04:52:57PM -0700, Andrii Nakryiko wrote: > > On Mon, Jul 22, 2024 at 10:55 PM Tony Ambardar > > wrote: > [...] > > > > > > Tony Ambardar (19): >

Re: [PATCH bpf-next v1 00/19] selftests/bpf: Improve libc portability / musl support (part 1)

2024-07-24 Thread Andrii Nakryiko
On Mon, Jul 22, 2024 at 10:55 PM Tony Ambardar wrote: > > Hello all, > > This series includes the bulk of libc-related compile fixes accumulated to > support systems using musl, with smaller numbers to follow. These patches > are simple and straightforward, and the series has been tested with the

Re: [PATCH bpf-next v1 19/19] selftests/bpf: Fix errors compiling cg_storage_multi.h with musl libc

2024-07-24 Thread Andrii Nakryiko
On Tue, Jul 23, 2024 at 3:35 PM YiFei Zhu wrote: > > On Mon, Jul 22, 2024 at 10:56 PM Tony Ambardar > wrote: > > > > Remove a redundant include of '', whose needed definitions are > > already included (via '') in cg_storage_multi_egress_only.c, > > cg_storage_multi_isolated.c, and cg_storage_mul

Re: [PATCH bpf-next v1] selftests/bpf: Fix wrong binary in Makefile log output

2024-07-23 Thread Andrii Nakryiko
On Mon, Jul 22, 2024 at 6:37 PM Eduard Zingerman wrote: > > On Mon, 2024-07-22 at 18:35 -0700, Tony Ambardar wrote: > [...] > > > Hi Andrii, > > > > I sent out a v2 based on your suggestions but omitted Eduard's Acked-by: > > by mistake. Should I resubmit or is that something you can update? > > T

Re: [PATCH bpf-next v1 2/2] selftests/bpf: Fix error linking uprobe_multi on mips

2024-07-22 Thread Andrii Nakryiko
On Sun, Jul 21, 2024 at 12:51 AM Tony Ambardar wrote: > > Linking uprobe_multi.c on mips64el fails due to relocation overflows, when > the GOT entries required exceeds the default maximum. Add a specific CFLAGS > (-mxgot) for uprobe_multi.c on MIPS that allows using a larger GOT and > avoids error

Re: [PATCH bpf-next v1] selftests/bpf: Fix wrong binary in Makefile log output

2024-07-19 Thread Andrii Nakryiko
On Fri, Jul 19, 2024 at 4:22 PM Tony Ambardar wrote: > > Make log output incorrectly shows 'test_maps' as the binary name for every > 'CLNG-BPF' build step, apparently picking up the last value defined for the > $(TRUNNER_BINARY) variable. Update the 'CLANG_BPF_BUILD_RULE' variants to > fix this c

Re: [PATCH bpf-next v1 1/3] bpf: Add bpf_file_d_path helper

2024-07-19 Thread Andrii Nakryiko
On Thu, Jul 18, 2024 at 4:53 AM Lin Yikai wrote: > > Add the "bpf_file_d_path" helper function > to retrieve the path from a struct file object. > But there is no need to include vmlinux.h > or reference the definition of struct file. > > Additionally, update the bpf.h tools uapi header. > > Signe

Re: [PATCH 1/2] uprobes: Optimize the return_instance related routines

2024-07-10 Thread Andrii Nakryiko
On Wed, Jul 10, 2024 at 1:19 AM Liao, Chang wrote: > > > > 在 2024/7/10 7:55, Andrii Nakryiko 写道: > > On Mon, Jul 8, 2024 at 6:00 PM Liao Chang wrote: > >> > >> Reduce the runtime overhead for struct return_instance data managed by > >> uretprobe. Th

Re: [PATCH 1/2] uprobes: Optimize the return_instance related routines

2024-07-09 Thread Andrii Nakryiko
On Mon, Jul 8, 2024 at 6:00 PM Liao Chang wrote: > > Reduce the runtime overhead for struct return_instance data managed by > uretprobe. This patch replaces the dynamic allocation with statically > allocated array, leverage two facts that are limited nesting depth of > uretprobe (max 64) and the f

Re: [PATCH 6/6] selftests/bpf: Skip ENOTSUPP in ASSERT_GE

2024-07-08 Thread Andrii Nakryiko
On Wed, Jul 3, 2024 at 11:48 PM Geliang Tang wrote: > > From: Geliang Tang > > There are still some "ENOTSUPP" (-524) errors left when running BPF > selftests on a Loongarch platform since ASSERT_GE() are used there to > check the return values, not ASSERT_OK(): > > ''' > test_bpf_cookie:PASS:sk

Re: [PATCH bpf-next v2 2/6] selftests/bpf: Skip ENOTSUPP in ASSERT_OK

2024-07-08 Thread Andrii Nakryiko
On Thu, Jul 4, 2024 at 7:38 PM Geliang Tang wrote: > > From: Geliang Tang > > Just like handling ENOTSUPP in test_lsm_cgroup_functional(), this patch > adds a new helper test_progs_get_error() to check whether the input error > is ENOTSUPP (524) or ENOTSUP (95). If it is, invoke test__skip() to s

Re: [PATCH] selftests/bpf: improve file descriptor closure handling

2024-06-26 Thread Andrii Nakryiko
On Wed, Jun 26, 2024 at 5:19 AM Ma Ke wrote: > > serial_test_fexit_stress() has a non-robust handling of file descriptor > closure. If an error occurs, the function may exit without closing open > file descriptors, potentially causing resource leaks. > > Fix the issue by closing file descriptors i

Re: [PATCH] selftests/bpf: don't close(-1) in serial_test_fexit_stress()

2024-06-26 Thread Andrii Nakryiko
On Sun, Jun 23, 2024 at 6:18 AM Ma Ke wrote: > > Guard close() with extra link_fd[i] >= 0 and fexit_fd[i] >= 0 > check to prevent close(-1). > > Signed-off-by: Ma Ke > --- > tools/testing/selftests/bpf/prog_tests/fexit_stress.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-18 Thread Andrii Nakryiko
On Tue, Jun 18, 2024 at 12:08 PM Jiri Olsa wrote: > > On Tue, Jun 18, 2024 at 09:58:23AM -0700, Andrii Nakryiko wrote: > > On Tue, Jun 18, 2024 at 5:43 AM Jiri Olsa wrote: > > > > > > On Mon, Jun 17, 2024 at 03:25:53PM -0700, Andrii Nakryiko wrote: > > >

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-18 Thread Andrii Nakryiko
On Tue, Jun 18, 2024 at 5:43 AM Jiri Olsa wrote: > > On Mon, Jun 17, 2024 at 03:25:53PM -0700, Andrii Nakryiko wrote: > > On Mon, Jun 10, 2024 at 6:04 AM Jiri Olsa wrote: > > > > > > On Sat, Jun 08, 2024 at 03:16:02PM -0600, Daniel Xu wrote: > > > > The

Re: [PATCH bpf-next v4 06/12] bpf: selftests: Fix bpf_session_cookie() kfunc prototype

2024-06-17 Thread Andrii Nakryiko
On Mon, Jun 10, 2024 at 6:04 AM Jiri Olsa wrote: > > On Sat, Jun 08, 2024 at 03:16:02PM -0600, Daniel Xu wrote: > > The prototype defined in bpf_kfuncs.h was not in line with how the > > actual kfunc was defined. This causes compilation errors when kfunc > > prototypes are generated from BTF. > >

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 scen

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 app

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 r

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 'test_in

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, like

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 + > tools/testing/selftests/bpf/pro

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 a/tools/testing/sel

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, sorr

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(), kernel_conne

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
diagnostic 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 Acke

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" dependen

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 > correspondin

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 +080

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 unboun

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 > c

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 coerce_reg_

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 Zinger

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

2023-12-19 Thread Andrii Nakryiko
; > 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: A

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. Th

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

2023-12-04 Thread Andrii Nakryiko
d. > > 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..67b4948865

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 > index

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 8:

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 selftests

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

2023-10-30 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 size

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

2023-10-23 Thread Andrii Nakryiko
On Mon, Oct 23, 2023 at 3:12 AM Tao Lyu wrote: > > > > > 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. > >> > >> # N

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 ins

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 success