Re: [PATCH v5 0/3] Kbuild: DWARF v5 support

2021-02-04 Thread Andrii Nakryiko
On Wed, Feb 3, 2021 at 7:13 PM Nick Desaulniers wrote: > > On Wed, Feb 3, 2021 at 6:58 PM Andrii Nakryiko > wrote: > > > > On Wed, Feb 3, 2021 at 5:31 PM Nick Desaulniers > > wrote: > > > > > > On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de M

Re: ANNOUNCE: pahole v1.20 (gcc11 DWARF5's default, lots of ELF sections, BTF)

2021-02-04 Thread Andrii Nakryiko
On Thu, Feb 4, 2021 at 2:09 PM Arnaldo Carvalho de Melo wrote: > > Hi, > > The v1.20 release of pahole and its friends is out, mostly > addressing problems related to gcc 11 defaulting to DWARF5 for -g, > available at the usual places: Great, thanks, Arnaldo! Do you plan to build RPMs

Re: ANNOUNCE: pahole v1.20 (gcc11 DWARF5's default, lots of ELF sections, BTF)

2021-02-04 Thread Andrii Nakryiko
On Thu, Feb 4, 2021 at 8:34 PM Arnaldo Carvalho de Melo wrote: > > > > On February 4, 2021 9:01:51 PM GMT-03:00, Andrii Nakryiko > wrote: > >On Thu, Feb 4, 2021 at 2:09 PM Arnaldo Carvalho de Melo> > >wrote: > >> The v1.20 release o

Re: [PATCH] selftests/bpf: Simplify the calculation of variables

2021-02-08 Thread Andrii Nakryiko
On Thu, Feb 4, 2021 at 10:27 PM Jiapeng Chong wrote: > > Fix the following coccicheck warnings: > > ./tools/testing/selftests/bpf/xdpxceiver.c:954:28-30: WARNING !A || A && > B is equivalent to !A || B. > > ./tools/testing/selftests/bpf/xdpxceiver.c:932:28-30: WARNING !A || A && > B is equivalent

Re: [PATCH] selftests: bpf: remove unneeded semicolon

2021-02-08 Thread Andrii Nakryiko
On Mon, Feb 8, 2021 at 2:30 AM Yang Li wrote: > > Eliminate the following coccicheck warning: > ./tools/testing/selftests/bpf/test_flow_dissector.c:506:2-3: Unneeded > semicolon > > Reported-by: Abaci Robot > Signed-off-by: Yang Li > --- Applied to bpf-next, changing subject to have more

Re: [PATCH bpf-next v7 2/5] bpf: Expose bpf_get_socket_cookie to tracing programs

2021-02-10 Thread Andrii Nakryiko
It's customary to send cover letter with patch sets of 2 or more related patches. It's a good place to explain the motivation of a patch set. And a good place to ack all patches in one go ;) Acked-by: Andrii Nakryiko > include/linux/bpf.h| 1 + > include/uapi/linux/bpf.h

Re: [PATCH] bpf_lru_list: Read double-checked variable once without lock

2021-02-10 Thread Andrii Nakryiko
On Tue, Feb 9, 2021 at 10:00 PM Martin KaFai Lau wrote: > > On Tue, Feb 09, 2021 at 12:27:01PM +0100, Marco Elver wrote: > > For double-checked locking in bpf_common_lru_push_free(), node->type is > > read outside the critical section and then re-checked under the lock. > > However, concurrent

Re: [PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-22 Thread Andrii Nakryiko
On Fri, Jan 22, 2021 at 8:31 AM Alan Maguire wrote: > > On Thu, 21 Jan 2021, Andrii Nakryiko wrote: > > > On Wed, Jan 20, 2021 at 10:56 PM Andrii Nakryiko > > wrote: > > > > > > On Sun, Jan 17, 2021 at 2:22 PM Alan Maguire > > > wrote: >

Re: [PATCH v2 0/8] Implement EBPF on powerpc32

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 7:42 AM Christophe Leroy wrote: > > > > Le 22/03/2021 à 18:53, Andrii Nakryiko a écrit : > > On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy > > wrote: > >> > >> This series implements extended BPF on powerpc32. For the impleme

Re: [PATCH bpf-next v2 2/6] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > This type provides the guarantee that an argument is going to be a const > pointer to somewhere in a read-only map value. It also checks that this > pointer is followed by a zero character before the end of the map value. > >

Re: [PATCH bpf-next v2 3/6] bpf: Add a bpf_snprintf helper

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > >

Re: [PATCH bpf-next 2/5] libbpf: add helpers for preparing netlink attributes

2021-03-26 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi wrote: > > This change introduces a few helpers to wrap open coded attribute > preparation in netlink.c. > > Every nested attribute's closure must happen using the helper > end_nlattr_nested, which sets its length properly. NLA_F_NESTED is >

Re: [PATCH bpf-next v2 4/6] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > When initializing the __param array with a one liner, if all args are > const, the initial array value will be placed in the rodata section but > because libbpf does not support relocation in the rodata section, any > pointer in this array

Re: [PATCH bpf-next v2 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 2:53 PM Andrii Nakryiko wrote: > > On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > > > Two helpers (trace_printk and seq_printf) have very similar > > implementations of format string parsing and a third one is coming > > (snprin

Re: [PATCH bpf-next v2 5/6] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- > tools/lib/bpf/bpf_tracing.h | 18

Re: [PATCH bpf-next v2 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations

Re: [PATCH bpf-next v2 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > This exercises most of the format specifiers when things go well. > > Signed-off-by: Florent Revest > --- Looks good. Please add a no-argument test case as well. Acked-by: Andrii Nakryiko > .../selftests/bpf/pro

Re: [PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-26 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi wrote: > > Update the header file so we can use the new defines in subsequent > patches. > > Reviewed-by: Toke Høiland-Jørgensen > Signed-off-by: Kumar Kartikeya Dwivedi > --- > tools/include/uapi/linux/pkt_cls.h | 174

Re: [PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 8:54 PM Kumar Kartikeya Dwivedi wrote: > > On Sat, Mar 27, 2021 at 04:55:51AM IST, Andrii Nakryiko wrote: > > On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi > > wrote: > > > > > > Update the header file so we can use the new

Re: [PATCH bpf-next] libbpf: fix bail out from 'ringbuf_process_ring()' on error

2021-03-25 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 8:02 AM Pedro Tammela wrote: > > The current code bails out with negative and positive returns. > If the callback returns a positive return code, 'ring_buffer__consume()' > and 'ring_buffer__poll()' will return a spurious number of records > consumed, but mostly important

Re: [PATCH bpf] bpf: link: refuse non-zero file_flags in BPF_OBJ_GET

2021-03-25 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 8:22 AM Lorenz Bauer wrote: > > Invoking BPF_OBJ_GET on a pinned bpf_link checks the path access > permissions based on file_flags, but the returned fd ignores flags. > This means that any user can acquire a "read-write" fd for a pinned > link with mode 0664 by invoking

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-28 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 6:40 PM Alexei Starovoitov wrote: > > On Sat, Mar 27, 2021 at 09:32:58PM -0700, Andrii Nakryiko wrote: > > > I think it's better to start with new library for tc/xdp and have > > > libbpf as a dependency on that new lib. > > > For example

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-03-31 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 9:11 AM Pedro Tammela wrote: > > The current way to provide a no-op flag to 'bpf_ringbuf_submit()', > 'bpf_ringbuf_discard()' and 'bpf_ringbuf_output()' is to provide a '0' > value. > > A '0' value might notify the consumer if it already caught up in processing, > so let's

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-31 Thread Andrii Nakryiko
On Tue, Mar 30, 2021 at 4:16 PM Alexei Starovoitov wrote: > > On Tue, Mar 30, 2021 at 3:54 PM Pedro Tammela wrote: > > > > BPF_CALL_2(bpf_ringbuf_submit, void *, sample, u64, flags) > > { > > + if (unlikely(flags & ~(BPF_RB_NO_WAKEUP | BPF_RB_FORCE_WAKEUP))) > > + return

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-31 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 9:12 AM Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela > --- > include/uapi/linux/bpf.h | 8 > kernel/bpf/ringbuf.c | 13 +++-- > tools/include/uapi/linux/bpf.h |

Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'

2021-03-31 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 9:28 AM Song Liu wrote: > > > > > On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > > > 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the > > constants that make the implementation don't wait or wait indefinetly > > for data. > > > >

Re: [PATCH] selftests/bpf: add LDFLAGS when building test_verifier

2021-03-31 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 11:11 AM Jisheng Zhang wrote: > > From: Jisheng Zhang > > This is useful for cross compile process to point linker to the > correct libelf, libcap, libz path. Is this enough to make cross-compilation of selftests/bpf work? I think there was a discussion another day about

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-05 Thread Andrii Nakryiko
On Fri, Apr 2, 2021 at 8:27 AM Kumar Kartikeya Dwivedi wrote: > > On Fri, Apr 02, 2021 at 05:49:29AM IST, Daniel Borkmann wrote: > > On 3/31/21 11:44 AM, Kumar Kartikeya Dwivedi wrote: > > > On Wed, Mar 31, 2021 at 02:55:47AM IST, Daniel Borkmann wrote: > > > > Do we even need the _block variant?

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-05 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 10:47 AM Alexei Starovoitov wrote: > > On Sat, Apr 03, 2021 at 12:38:06AM +0530, Kumar Kartikeya Dwivedi wrote: > > On Sat, Apr 03, 2021 at 12:02:14AM IST, Alexei Starovoitov wrote: > > > On Fri, Apr 2, 2021 at 8:27 AM Kumar Kartikeya Dwivedi > > > wrote: > > > > [...] >

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-04-03 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 6:34 AM Pedro Tammela wrote: > > Em qua., 31 de mar. de 2021 às 03:54, Andrii Nakryiko > escreveu: > > > > On Sun, Mar 28, 2021 at 9:11 AM Pedro Tammela wrote: > > > > > > The current way to provide a no-op flag to 'bpf_ringbu

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-04-03 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 6:29 AM Pedro Tammela wrote: > > Em qua., 31 de mar. de 2021 às 04:02, Andrii Nakryiko > escreveu: > > > > On Tue, Mar 30, 2021 at 4:16 PM Alexei Starovoitov > > wrote: > > > > > > On Tue, Mar 30, 2021 at 3:54 PM Pedr

Re: [PATCH] libbpf: Fix KERNEL_VERSION macro

2021-04-04 Thread Andrii Nakryiko
On Sun, Apr 4, 2021 at 2:53 AM Hengqi Chen wrote: > > Add missing ')' for KERNEL_VERSION macro. > > Signed-off-by: Hengqi Chen > --- The fix looks good, thank you. But your patch didn't make it into bpf/netdev patchworks instance ([0]) most probably due to too long CC list. Can you please

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-27 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 7:15 PM Alexei Starovoitov wrote: > > On Thu, Mar 25, 2021 at 05:30:03PM +0530, Kumar Kartikeya Dwivedi wrote: > > This adds some basic tests for the low level bpf_tc_* API and its > > bpf_program__attach_tc_* wrapper on top. > > *_block() apis from patch 3 and 4 are not

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-27 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:02 AM Kumar Kartikeya Dwivedi wrote: > > This adds functions that wrap the netlink API used for adding, > manipulating, and removing filters and actions. These functions operate > directly on the loaded prog's fd, and return a handle to the filter and > action using an

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-30 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 1:11 AM Kumar Kartikeya Dwivedi wrote: > > On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: > > Is there some succinct but complete enough documentation/tutorial/etc > > that I can reasonably read to understand kernel APIs provided by

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-30 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 8:28 PM Alexei Starovoitov wrote: > > On Sun, Mar 28, 2021 at 07:38:42PM -0700, Andrii Nakryiko wrote: > > > > See above. I don't know which hassle is libbpf for users today. You > > were implying code size used for functionality users might n

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 1:43 PM Sultan Alsawaf wrote: > > From: Sultan Alsawaf > > We should be using the program fd here, not the perf event fd. Why? Can you elaborate on what issue you ran into with the current code? > > Fixes: 63f2f5ee856ba ("libbpf: add ability to attach/detach BPF program

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 6:43 PM Sultan Alsawaf wrote: > > On Fri, Mar 12, 2021 at 06:33:01PM -0800, Andrii Nakryiko wrote: > > On Fri, Mar 12, 2021 at 6:22 PM Sultan Alsawaf > > wrote: > > > > > > On Fri, Mar 12, 2021 at 05:31:14PM -0800, Andrii Nakryiko wrot

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 6:22 PM Sultan Alsawaf wrote: > > On Fri, Mar 12, 2021 at 05:31:14PM -0800, Andrii Nakryiko wrote: > > On Fri, Mar 12, 2021 at 1:43 PM Sultan Alsawaf > > wrote: > > > > > > From: Sultan Alsawaf > > > > > > We shou

Re: [PATCH] samples: bpf: Fix a spelling typo in do_hbm_test.sh

2021-03-15 Thread Andrii Nakryiko
On Mon, Mar 15, 2021 at 5:45 AM Masanari Iida wrote: > > This patch fixes a spelling typo in do_hbm_test.sh > > Signed-off-by: Masanari Iida > --- Thanks, applied to bpf-next. For the future patches, please use [PATCH bpf-next] subject prefix if you are sending patches against bpf-next tree (of

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Mon, Mar 15, 2021 at 9:36 PM Andrii Nakryiko wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > > When initializing the __param array with a one liner, if all args are > > const, the initial array value will be placed in the rodata section but

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > This type provides the guarantee that an argument is going to be a const > pointer to somewhere in a read-only map value. It also checks that this > pointer is followed by a NULL character before the end of the map value. > >

Re: [PATCH bpf-next 2/5] bpf: Add a bpf_snprintf helper

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > >

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > When initializing the __param array with a one liner, if all args are > const, the initial array value will be placed in the rodata section but > because libbpf does not support relocation in the rodata section, any > pointer in this array

Re: [PATCH bpf-next 5/5] selftests/bpf: Add a series of tests for bpf_snprintf

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > This exercices most of the format specifiers when things go well. typo: exercises > > Signed-off-by: Florent Revest > --- > .../selftests/bpf/prog_tests/snprintf.c | 71 +++ >

Re: [PATCH bpf-next 4/5] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- > tools/lib/bpf/bpf_tracing.h | 15 +++ >

Re: [BUG] One-liner array initialization with two pointers in BPF results in NULLs

2021-03-10 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 8:59 AM Yonghong Song wrote: > > > > On 3/10/21 3:48 AM, Florent Revest wrote: > > On Wed, Mar 10, 2021 at 6:16 AM Yonghong Song wrote: > >> On 3/9/21 7:43 PM, Yonghong Song wrote: > >>> On 3/9/21 5:54 PM, Florent Revest wrote: > I noticed that initializing an array

Re: [BUG] One-liner array initialization with two pointers in BPF results in NULLs

2021-03-10 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 12:12 PM Andrii Nakryiko wrote: > > On Wed, Mar 10, 2021 at 8:59 AM Yonghong Song wrote: > > > > > > > > On 3/10/21 3:48 AM, Florent Revest wrote: > > > On Wed, Mar 10, 2021 at 6:16 AM Yonghong Song wrote: > > >> On 3/9

Re: [PATCH v2 0/8] Implement EBPF on powerpc32

2021-03-22 Thread Andrii Nakryiko
On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy wrote: > > This series implements extended BPF on powerpc32. For the implementation > details, see the patch before the last. > > The following operations are not implemented: > > case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */ >

Re: [PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h'

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 2:01 PM Daniel Borkmann wrote: > > On 3/14/21 6:38 PM, Pedro Tammela wrote: > > Linux headers might pull 'linux/stddef.h' which defines > > '__always_inline' as the following: > > > > #ifndef __always_inline > > #define __always_inline __inline__ > > #endif > >

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 4:58 PM Florent Revest wrote: > > On Tue, Mar 16, 2021 at 2:03 AM Andrii Nakryiko > wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > + } else if (arg_type == ARG_PTR_TO_CONST_STR) { > > > + s

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 5:46 PM Florent Revest wrote: > > On Wed, Mar 17, 2021 at 1:35 AM Andrii Nakryiko > wrote: > > On Tue, Mar 16, 2021 at 4:58 PM Florent Revest wrote: > > > On Tue, Mar 16, 2021 at 2:03 AM Andrii Nakryiko > > > wrote: > > > > O

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 3:43 PM Florent Revest wrote: > > On Tue, Mar 16, 2021 at 5:36 AM Andrii Nakryiko > wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > +#define ___bpf_build_param0(narg, x) > > > +#define ___bpf_build_param

Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-22 Thread Andrii Nakryiko
On Mon, Feb 22, 2021 at 11:16 PM Song Liu wrote: > > > > > On Feb 22, 2021, at 10:21 PM, Andrii Nakryiko > > wrote: > > > > On Mon, Feb 22, 2021 at 5:23 PM Song Liu wrote: > >> > >> BPF helpers bpf_task_storage_[get|delete] could hold

Re: [PATCH v4 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete]

2021-02-22 Thread Andrii Nakryiko
On Mon, Feb 22, 2021 at 5:23 PM Song Liu wrote: > > BPF helpers bpf_task_storage_[get|delete] could hold two locks: > bpf_local_storage_map_bucket->lock and bpf_local_storage->lock. Calling > these helpers from fentry/fexit programs on functions in bpf_*_storage.c > may cause deadlock on either

Re: [PATCH v4 bpf-next 5/6] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h

2021-02-22 Thread Andrii Nakryiko
On Mon, Feb 22, 2021 at 5:24 PM Song Liu wrote: > > Update the Makefile to prefer using $(O)/mvlinux, $(KBUILD_OUTPUT)/vmlinux > (for selftests) or ../../../vmlinux. These two files should have latest > definitions for vmlinux.h. > > Signed-off-by: Song Liu > --- Acke

Re: [PATCH] libbpf: Remove unnecessary conversion to bool

2021-02-22 Thread Andrii Nakryiko
On Sat, Feb 20, 2021 at 1:11 AM Jiapeng Chong wrote: > > Fix the following coccicheck warnings: > > ./tools/lib/bpf/libbpf.c:1487:43-48: WARNING: conversion to bool not > needed here. > > Reported-by: Abaci Robot > Signed-off-by: Jiapeng Chong > --- I think this came up before already. I did

Re: [PATCH bpf-next v2 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-07 Thread Andrii Nakryiko
On Wed, Apr 7, 2021 at 12:30 PM Pedro Tammela wrote: > > Em qua., 7 de abr. de 2021 às 15:31, Andrii Nakryiko > escreveu: > > > > On Tue, Apr 6, 2021 at 11:55 AM Pedro Tammela wrote: > > > > > > This macro was refactored out of the bpf selftests. > &g

Re: [PATCH bpf-next v2 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-07 Thread Andrii Nakryiko
On Tue, Apr 6, 2021 at 11:55 AM Pedro Tammela wrote: > > This macro was refactored out of the bpf selftests. > > Since percpu values are rounded up to '8' in the kernel, a careless > user in userspace might encounter unexpected values when parsing the > output of the batched operations. I wonder

Re: [syzbot] memory leak in bpf (2)

2021-04-07 Thread Andrii Nakryiko
On Wed, Mar 31, 2021 at 6:08 PM syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit:0f4498ce Merge tag 'for-5.12/dm-fixes-2' of git://git.kern.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1250e126d0 > kernel config:

Re: [PATCH bpf-next] libbpf: clarify flags in ringbuf helpers

2021-04-07 Thread Andrii Nakryiko
On Wed, Apr 7, 2021 at 11:43 AM Joe Stringer wrote: > > Hi Pedro, > > On Tue, Apr 6, 2021 at 11:58 AM Pedro Tammela wrote: > > > > In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. > > > > For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a > > notification to

Re: [PATCH bpf-next v2 3/6] bpf: Add a bpf_snprintf helper

2021-04-07 Thread Andrii Nakryiko
On Tue, Apr 6, 2021 at 9:06 AM Florent Revest wrote: > > On Fri, Mar 26, 2021 at 11:55 PM Andrii Nakryiko > wrote: > > On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > > The implementation takes inspiration from the existing bpf_trace_printk > > > helpe

Re: [PATCH bpf-next] libbpf: clarify flags in ringbuf helpers

2021-04-07 Thread Andrii Nakryiko
On Wed, Apr 7, 2021 at 1:10 PM Pedro Tammela wrote: > > Em qua., 7 de abr. de 2021 às 16:58, Andrii Nakryiko > escreveu: > > > > On Wed, Apr 7, 2021 at 11:43 AM Joe Stringer wrote: > > > > > > Hi Pedro, > > > > >

Re: [PATCH bpf-next v2 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-07 Thread Andrii Nakryiko
On Tue, Apr 6, 2021 at 8:35 AM Florent Revest wrote: > > [Sorry for the late replies, I'm just back from a long easter break :)] > > On Fri, Mar 26, 2021 at 11:51 PM Andrii Nakryiko > wrote: > > On Fri, Mar 26, 2021 at 2:53 PM Andrii Nakryiko > > wrote: > >

Re: memory leak in bpf

2021-04-07 Thread Andrii Nakryiko
On Wed, Apr 7, 2021 at 4:24 PM Rustam Kovhaev wrote: > > On Mon, Mar 01, 2021 at 09:43:00PM +0100, Dmitry Vyukov wrote: > > On Mon, Mar 1, 2021 at 9:39 PM Rustam Kovhaev wrote: > > > > > > On Mon, Mar 01, 2021 at 08:05:42PM +0100, Dmitry Vyukov wrote: > > > > On Mon, Mar 1, 2021 at 5:21 PM

Re: [PATCH bpf-next v2] libbpf: clarify flags in ringbuf helpers

2021-04-12 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 12:25 PM Pedro Tammela wrote: > > In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. > > For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a > notification to the process if needed. > > Signed-off-by: Pedro Tammela > --- Great, thanks!

Re: [PATCH] selftests/bpf: Fix the ASSERT_ERR_PTR macro

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:58 AM Martin KaFai Lau wrote: > > On Wed, Apr 14, 2021 at 05:56:32PM +0200, Florent Revest wrote: > > It is just missing a ';'. This macro is not used by any test yet. > > > > Signed-off-by: Florent Revest > Fixes: 22ba36351631 ("selftests/bpf: Move and extend

Re: [PATCH bpf-next v4 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations

Re: [PATCH bpf-next v4 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 2:33 AM Florent Revest wrote: > > On Thu, Apr 15, 2021 at 2:38 AM Andrii Nakryiko > wrote: > > On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > > +static int try_get_fmt_tmp_buf(char **tmp_buf) > > > +{ > >

Re: [PATCH bpf-next v4 3/6] bpf: Add a bpf_snprintf helper

2021-04-15 Thread Andrii Nakryiko
string length > arg. > > Because the format-string is known at verification time, we also do > a first pass of format string validation in the verifier logic. This > makes debugging easier. > > Signed-off-by: Florent Revest > --- LGTM. Acked-by: Andrii Nakryiko >

Re: [PATCH bpf-next v4 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-15 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > The "positive" part tests all format specifiers when things go well. > > The "negative" part makes sure that incorrect format strings fail at > load time. > > Signed-off-by: Florent Revest > --- > .../selftests/bpf/prog_tests/snprintf.c

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 8:57 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On Wed, A

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 3:10 PM Daniel Borkmann wrote: > > On 4/15/21 1:58 AM, Andrii Nakryiko wrote: > > On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann > > wrote: > >> On 4/15/21 1:19 AM, Andrii Nakryiko wrote: > >>> On Wed, Apr 14, 2021 at 3:51

Re: [PATCH bpf-next v5 0/6] Add a snprintf eBPF helper

2021-04-19 Thread Andrii Nakryiko
f/prog_tests/snprintf.c > create mode 100644 tools/testing/selftests/bpf/progs/test_snprintf.c > create mode 100644 tools/testing/selftests/bpf/progs/test_snprintf_single.c > > -- > 2.31.1.368.gbe11c130af-goog > Looks great, thank you! For the series: Acked-by: Andrii Nakryiko

Re: [PATCH bpf-next v2 4/4] libbpf: add selftests for TC-BPF API

2021-04-19 Thread Andrii Nakryiko
On Mon, Apr 19, 2021 at 5:18 AM Kumar Kartikeya Dwivedi wrote: > > This adds some basic tests for the low level bpf_tc_cls_* API. > > Reviewed-by: Toke Høiland-Jørgensen > Signed-off-by: Kumar Kartikeya Dwivedi > --- > .../selftests/bpf/prog_tests/test_tc_bpf.c| 112 ++ >

Re: mmotm 2021-04-11-20-47 uploaded (bpf: xsk.c)

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 9:38 AM Randy Dunlap wrote: > > On 4/11/21 8:48 PM, a...@linux-foundation.org wrote: > > The mm-of-the-moment snapshot 2021-04-11-20-47 has been uploaded to > > > >https://www.ozlabs.org/~akpm/mmotm/ > > > > mmotm-readme.txt says > > > > README for mm-of-the-moment: >

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > >

Re: [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > This exercises most of the format specifiers. > > Signed-off-by: Florent Revest > Acked-by: Andrii Nakryiko > --- As I mentioned on another patch, we probably need negative tests even more than positive ones. I thin

Re: [PATCH bpf-next v3 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations

Re: [PATCH bpf-next v3 2/6] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-04-13 Thread Andrii Nakryiko
t; > Signed-off-by: Florent Revest > --- LGTM. Acked-by: Andrii Nakryiko > include/linux/bpf.h | 1 + > kernel/bpf/verifier.c | 41 + > 2 files changed, 42 insertions(+) > [...]

Re: [PATCH bpf-next v3 5/6] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- Nice! Acked-by: Andrii Nakryiko

Re: [PATCH bpf-next v3 4/6] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-04-13 Thread Andrii Nakryiko
r in this array will stay NULL. > > Fixes: c09add2fbc5a ("tools/libbpf: Add bpf_iter support") > Signed-off-by: Florent Revest > --- Looks good! Acked-by: Andrii Nakryiko > tools/lib/bpf/bpf_tracing.h | 40 +++-- > 1 file changed, 29 insertions(+), 11 deletions(-) > [...]

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-13 Thread Andrii Nakryiko
On Tue, Apr 6, 2021 at 3:06 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Sat, Apr 3, 2021 at 10:47 AM Alexei Starovoitov > > wrote: > >> > >> On Sat, Apr 03, 2021 at 12:38:06AM +0530, Kumar Kartikeya Dwivedi wrote: > >>

Re: [PATCH v3 bpf-next 11/11] bpf: Test BPF_SK_REUSEPORT_SELECT_OR_MIGRATE.

2021-04-20 Thread Andrii Nakryiko
On Tue, Apr 20, 2021 at 8:45 AM Kuniyuki Iwashima wrote: > > This patch adds a test for BPF_SK_REUSEPORT_SELECT_OR_MIGRATE and > removes 'static' from settimeo() in network_helpers.c. > > Signed-off-by: Kuniyuki Iwashima > --- Almost everything in prog_tests/migrate_reuseport.c should be

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 2:46 AM Florent Revest wrote: > > On Wed, Apr 14, 2021 at 1:16 AM Andrii Nakryiko > wrote: > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > > +static int check_bpf_snprintf_call(struct bpf_verifier_env *env, > > > +

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:30 AM Florent Revest wrote: > > Hey Geert! :) > > On Wed, Apr 14, 2021 at 8:02 PM Geert Uytterhoeven > wrote: > > On Wed, Apr 14, 2021 at 9:41 AM Andrii Nakryiko > > wrote: > > > On Mon, Apr 12, 2021 at 8:38 AM Florent Reves

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On Tue,

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann wrote: > > On 4/15/21 1:19 AM, Andrii Nakryiko wrote: > > On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen > > wrote: > >> Andrii Nakryiko writes: > >>> On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Tue, Apr 6, 2021 at 3:06 AM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On S

Re: [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 2:21 AM Florent Revest wrote: > > On Wed, Apr 14, 2021 at 1:21 AM Andrii Nakryiko > wrote: > > > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > > > > > This exercises most of the format specifiers. > > >

Re: ANNOUNCE: pahole v1.20 (gcc11 DWARF5's default, lots of ELF sections, BTF)

2021-02-05 Thread Andrii Nakryiko
On Fri, Feb 5, 2021 at 8:25 AM Arnaldo Carvalho de Melo wrote: > > Em Fri, Feb 05, 2021 at 06:33:43AM -0300, Arnaldo Carvalho de Melo escreveu: > > On February 5, 2021 4:39:47 AM GMT-03:00, Andrii Nakryiko > > wrote: > > >On Thu, Feb 4, 2021 at 8:34 PM Arnaldo Car

Re: ANNOUNCE: pahole v1.20 (gcc11 DWARF5's default, lots of ELF sections, BTF)

2021-02-06 Thread Andrii Nakryiko
On Fri, Feb 5, 2021 at 3:55 PM Arnaldo Carvalho de Melo wrote: > > Em Fri, Feb 05, 2021 at 02:11:44PM -0800, Andrii Nakryiko escreveu: > > On Fri, Feb 5, 2021 at 8:25 AM Arnaldo Carvalho de Melo > > wrote: > > > > > > Em Fri, Feb 05, 2021 at 06:33:

Re: [RFC PATCH bpf-next] bpf: change syscall_nr type to int in struct syscall_tp_t

2023-10-13 Thread Andrii Nakryiko
On Fri, Oct 13, 2023 at 7:00 AM Steven Rostedt wrote: > > On Fri, 13 Oct 2023 08:01:34 +0200 > Artem Savkov wrote: > > > > But looking at [0] and briefly reading some of the discussions you, > > > Steven, had. I'm just wondering if it would be best to avoid > > > increasing struct trace_entry

[PATCH] tracing/kprobes: Fix symbol counting logic by looking at modules as well

2023-10-27 Thread Andrii Nakryiko
to kallsyms_on_each_match_symbol() to perform a proper counting. Cc: Francis Laniel Cc: sta...@vger.kernel.org Cc: Masami Hiramatsu Cc: Steven Rostedt Fixes: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols") Signed-off-by: Andrii Nakryiko --- kernel/trace/trace_kpr

Re: [PATCH for-next] tracing/kprobes: Add symbol counting check when module loads

2023-10-31 Thread Andrii Nakryiko
- > kernel/trace/trace_kprobe.c | 112 > ++- > 1 file changed, 68 insertions(+), 44 deletions(-) > LGTM. Acked-by: Andrii Nakryiko > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index e834f149695b..90cf2219adb4 100644 > --- a/kernel/trace/trace_kpro

Re: [RFC PATCH] tracing: change syscall number type in struct syscall_trace_*

2023-10-03 Thread Andrii Nakryiko
On Mon, Oct 2, 2023 at 6:53 AM Artem Savkov wrote: > > linux-rt-devel tree contains a patch that adds an extra member to struct can you please point to the patch itself that makes that change? > trace_entry. This causes the offset of args field in struct > trace_event_raw_sys_enter be different

Re: [RFC PATCH bpf-next] bpf: change syscall_nr type to int in struct syscall_tp_t

2023-10-12 Thread Andrii Nakryiko
On Thu, Oct 12, 2023 at 6:43 AM Steven Rostedt wrote: > > On Thu, 12 Oct 2023 13:45:50 +0200 > Artem Savkov wrote: > > > linux-rt-devel tree contains a patch (b1773eac3f29c ("sched: Add support > > for lazy preemption")) that adds an extra member to struct trace_entry. > > This causes the offset

Re: [PATCH v4 2/2] rethook: honor CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING in rethook_try_get()

2024-04-19 Thread Andrii Nakryiko
On Thu, Apr 18, 2024 at 6:00 PM Masami Hiramatsu wrote: > > On Thu, 18 Apr 2024 12:09:09 -0700 > Andrii Nakryiko wrote: > > > Take into account CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING when validating > > that RCU is watching when trying to setup rethooko on a function en

Re: [PATCH v3 2/2] rethook: honor CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING in rethook_try_get()

2024-04-18 Thread Andrii Nakryiko
On Tue, Apr 9, 2024 at 3:48 PM Masami Hiramatsu wrote: > > On Wed, 3 Apr 2024 15:03:28 -0700 > Andrii Nakryiko wrote: > > > Take into account CONFIG_FTRACE_VALIDATE_RCU_IS_WATCHING when validating > > that RCU is watching when trying to setup rethooko on a function ent

Re: [PATCHv2 1/3] uprobe: Add uretprobe syscall to speed up return probe

2024-04-18 Thread Andrii Nakryiko
On Mon, Apr 15, 2024 at 1:25 AM Jiri Olsa wrote: > > On Tue, Apr 02, 2024 at 11:33:00AM +0200, Jiri Olsa wrote: > > SNIP > > > #include > > #include > > @@ -308,6 +309,88 @@ static int uprobe_init_insn(struct arch_uprobe > > *auprobe, struct insn *insn, bool > > } > > > > #ifdef

<    1   2   3   4   5   6   >