Re: [PATCH bpf-next v3 5/6] bpf: Add an iterator selftest for bpf_sk_storage_get

2020-11-27 Thread Florent Revest
On Thu, 2020-11-26 at 23:00 -0800, Yonghong Song wrote: > On 11/26/20 8:44 AM, Florent Revest wrote: > > +SEC("iter/task_file") > > +int fill_socket_owner(struct bpf_iter__task_file *ctx) > > +{ > > + struct task_struct *task = ctx->task; > > +

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-11-27 Thread Florent Revest
On Fri, 2020-11-27 at 03:32 +0100, KP Singh wrote: > > + ret = strlen(name) + 1; > > + if (symbol_size) { > > + strncpy(symbol, name, symbol_size); > > + symbol[symbol_size - 1] = '\0'; > > + } > > + > > + if (modname && module_size) { > > +

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-11-27 Thread Florent Revest
On Fri, 2020-11-27 at 10:25 +0100, Florent Revest wrote: > I prefer Yongonhong's suggestion of having two helpers. Argh! I hit enter too fast! Yonghong*, sorry :|

Re: [PATCH bpf-next v5 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-26 Thread Florent Revest
On Sat, Jan 23, 2021 at 9:45 PM Yonghong Song wrote: > On 1/22/21 7:34 AM, Florent Revest wrote: > > On Wed, Jan 20, 2021 at 8:06 PM Florent Revest wrote: > >> > >> On Wed, Jan 20, 2021 at 8:04 PM Alexei Starovoitov > >> wrote: > >>> >

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

2021-01-30 Thread Florent Revest
On Wed, Jan 27, 2021 at 10:01 PM Andrii Nakryiko wrote: > > On Tue, Jan 26, 2021 at 10:36 AM Florent Revest wrote: > > > > This needs a new helper that: > > - can work in a sleepable context (using sock_gen_cookie) > > - takes a struct sock pointer and checks tha

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

2021-01-30 Thread Florent Revest
On Fri, Jan 29, 2021 at 1:49 PM Daniel Borkmann wrote: > > On 1/29/21 11:57 AM, Daniel Borkmann wrote: > > On 1/27/21 10:01 PM, Andrii Nakryiko wrote: > >> On Tue, Jan 26, 2021 at 10:36 AM Florent Revest > >> wrote: > >>> > >>> This ne

[PATCH bpf-next v6 1/5] bpf: Be less specific about socket cookies guarantees

2021-01-26 Thread Florent Revest
by: Daniel Borkmann Signed-off-by: Florent Revest Acked-by: KP Singh --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c001766adcbc..0b

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

2021-01-26 Thread Florent Revest
This needs a new helper that: - can work in a sleepable context (using sock_gen_cookie) - takes a struct sock pointer and checks that it's not NULL Signed-off-by: Florent Revest Acked-by: KP Singh --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 8 kernel

[PATCH bpf-next v6 3/5] selftests/bpf: Integrate the socket_cookie test to test_progs

2021-01-26 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest Acked-by: KP Singh --- tools/testing/selftests/bpf/.gitignore| 1 - tools/testing/selftests/bpf/Makefile

[PATCH bpf-next v6 4/5] selftests/bpf: Use vmlinux.h in socket_cookie_prog.c

2021-01-26 Thread Florent Revest
e need to extract ctx->sk in a variable before checking and dereferencing it. Acked-by: KP Singh Signed-off-by: Florent Revest --- .../testing/selftests/bpf/progs/socket_cookie_prog.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/

[PATCH bpf-next v6 5/5] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-26 Thread Florent Revest
storage with 0xFF, this uses both an update_cookie_sockops program and an update_cookie_tracing program which succesively tag the socket with 0x0F and then 0xF0. Signed-off-by: Florent Revest Acked-by: KP Singh --- .../selftests/bpf/prog_tests/socket_cookie.c | 11 -- .../selftests/bpf/progs

Re: [RFC 04/11] KVM, arm, arm64: Offer PAs to IPAs idmapping to internal VMs

2017-09-26 Thread Florent Revest
On Thu, 2017-08-31 at 11:23 +0200, Christoffer Dall wrote: > > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > > index 2ea21da..1d2d3df 100644 > > --- a/virt/kvm/arm/mmu.c > > +++ b/virt/kvm/arm/mmu.c > > @@ -772,6 +772,11 @@ static void stage2_unmap_memslot(struct kvm > > *kvm, > >

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-09-26 Thread Florent Revest
On Thu, 2017-08-31 at 11:26 +0200, Christoffer Dall wrote: > I wonder if this should be split into two series; one that sets up > anything you may need from KVM, and another one that uses that for > UEFI. > > There's a lot KVM and UEFI intertwined logic and assumptions in patch > 10, which makes

Re: [RFC 00/11] KVM, EFI, arm64: EFI Runtime Services Sandboxing

2017-09-26 Thread Florent Revest
On Fri, 2017-09-22 at 14:44 -0700, Ard Biesheuvel wrote: > From the EFI side, there are some minor concerns on my part regarding > the calling convention, and the fact that we can no longer invoke > runtime services from a kernel running at EL1, but those all seem > fixable. I will respond to the

[RFC 00/10] Add Sunxi Cedrus Video Decoder Driver

2016-08-25 Thread Florent Revest
d/1RLkH3QxdmrcW_t41KllEvUmVsrHMbMOgd6CqAgzR7U4/pub?slide=id.p [3] https://lwn.net/Articles/688585/ [4] https://lwn.net/Articles/641204/ [5] https://github.com/FlorentRevest/linux-sunxi-cedrus [6] https://github.com/FlorentRevest/sunxi-cedrus-drv-video Florent Revest (9): clk: sunxi-ng: Add a couple

[RFC 05/10] v4l: Add MPEG4 low-level decoder API control

2016-08-25 Thread Florent Revest
This control is to be used with the new low-level decoder API for MPEG4 to provide additional parameters for the hardware that cannot parse the input stream. Some fields are still missing for this structure to be complete. Signed-off-by: Florent Revest --- drivers/media/v4l2-core/v4l2-ctrls.c

[RFC 09/10] ARM: dts: sun5i: Use video-engine node

2016-08-25 Thread Florent Revest
Now that we have a driver matching "allwinner,sun5i-a13-video-engine" we can load it. The "video-engine" node depends on the new sunxi-ng's CCU clock and reset bindings. This patch also includes a ve_reserved DMA pool for videobuf2 buffer allocations in sunxi-cedrus. Si

[RFC 04/10] v4l: Add MPEG2 low-level decoder API control

2016-08-25 Thread Florent Revest
This control is to be used with the new low-level decoder API for MPEG2 to provide additional parameters for the hardware that cannot parse the input stream. Signed-off-by: Florent Revest --- drivers/media/v4l2-core/v4l2-ctrls.c | 11 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 1

[RFC 10/10] sunxi-cedrus: Add device tree binding document

2016-08-25 Thread Florent Revest
Device Tree bindings for the Allwinner's video engine Signed-off-by: Florent Revest --- .../devicetree/bindings/media/sunxi-cedrus.txt | 44 ++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/sunxi-cedrus.txt diff --git

[RFC 07/10] sunxi-cedrus: Add a MPEG 2 codec

2016-08-25 Thread Florent Revest
This patch introduces the support of MPEG2 video decoding to the sunxi-cedrus video decoder driver. Signed-off-by: Florent Revest --- drivers/media/platform/sunxi-cedrus/Makefile | 2 +- drivers/media/platform/sunxi-cedrus/sunxi_cedrus.c | 26 +++- .../platform/sunxi-cedrus

[RFC 03/10] v4l: Add sunxi Video Engine pixel format

2016-08-25 Thread Florent Revest
Add support for the allwinner's proprietary pixel format described in details here: http://linux-sunxi.org/File:Ve_tile_format_v1.pdf This format is similar to V4L2_PIX_FMT_NV12M but the planes are divided in tiles of 32x32px. Signed-off-by: Florent Revest --- include/uapi/linux/videodev2.h

[RFC 08/10] sunxi-cedrus: Add a MPEG 4 codec

2016-08-25 Thread Florent Revest
This patch introduces the support of MPEG4 video decoding to the sunxi-cedrus video decoder driver. Signed-off-by: Florent Revest --- drivers/media/platform/sunxi-cedrus/Makefile | 3 +- drivers/media/platform/sunxi-cedrus/sunxi_cedrus.c | 15 +++ .../platform/sunxi-cedrus

[RFC 01/10] clk: sunxi-ng: Add a couple of A13 clocks

2016-08-25 Thread Florent Revest
Add a new style driver for the clock control unit in Allwinner A13. Only AVS and VE are supported since they weren't provided until now and are needed for "sunxi-cedrus". Signed-off-by: Florent Revest --- .../devicetree/bindings/clock/sunxi-ccu.txt| 1 + arch/arm/boot/dts

[RFC 02/10] v4l: Add private compound control type.

2016-08-25 Thread Florent Revest
From: Pawel Osciak V4L2_CTRL_TYPE_PRIVATE is to be used for private driver compound controls that use the "ptr" member of struct v4l2_ext_control. Signed-off-by: Pawel Osciak Signed-off-by: Jung Zhao Signed-off-by: Florent Revest --- drivers/media/v4l2-core/v4l2-ctrls.c | 4 +++

[RFC 06/10] media: platform: Add Sunxi Cedrus decoder driver

2016-08-25 Thread Florent Revest
ngineering on which I based my work comes from the "Cedrus" project: http://linux-sunxi.org/Cedrus The driver currently only runs on the A13 and this patch doesn't include any codec. Signed-off-by: Florent Revest --- drivers/media/platform/Kconfig | 13 + dr

Re: linux-next: Tree for Dec 7 (bpf: sock_from_file)

2020-12-07 Thread Florent Revest
On Mon, 2020-12-07 at 10:39 -0800, Randy Dunlap wrote: > On 12/7/20 1:25 AM, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20201204: > > > > on i386: > # CONFIG_NET is not set > > ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file': > bpf_trace.c:(.text+0xe23): undefined

[PATCH bpf-next] bpf: Only call sock_from_file with CONFIG_NET

2020-12-07 Thread Florent Revest
This avoids ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file': bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file' When compiling a kernel with BPF and without NET. Reported-by: Randy Dunlap Signed-off-by: Florent Revest --- kernel/trace/bpf_trace.c | 4 1

Re: [PATCH bpf-next] bpf: Only call sock_from_file with CONFIG_NET

2020-12-07 Thread Florent Revest
On Mon, 2020-12-07 at 20:55 +0100, Florent Revest wrote: > This avoids > ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file': > bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file' > When compiling a kernel with BPF and without NET. > > Reporte

[PATCH bpf-next v2] bpf: Only call sock_from_file with CONFIG_NET

2020-12-07 Thread Florent Revest
This avoids ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file': bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file' When compiling a kernel with BPF and without NET. Reported-by: Randy Dunlap Signed-off-by: Florent Revest --- kernel/trace/bpf_trace.c | 4 1

Re: linux-next: build failure after merge of the block tree

2020-12-07 Thread Florent Revest
On Mon, 2020-12-07 at 14:09 +1100, Stephen Rothwell wrote: > Hi all, > > After merging the block tree, today's linux-next build (powerpc > ppc64_defconfig) failed like this: > > fs/io_uring.c: In function 'io_shutdown': > fs/io_uring.c:3782:9: error: too many arguments to function >

Re: [PATCH bpf-next v2] bpf: Only call sock_from_file with CONFIG_NET

2020-12-08 Thread Florent Revest
On Mon, 2020-12-07 at 13:33 -0800, Martin KaFai Lau wrote: > On Mon, Dec 07, 2020 at 09:06:05PM +0100, Florent Revest wrote: > > This avoids > > ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file': > > bpf_trace.c:(.text+0xe23): undefined reference to > >

[PATCH bpf-next v3] bpf: Only provide bpf_sock_from_file with CONFIG_NET

2020-12-08 Thread Florent Revest
': bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file' When compiling a kernel with BPF and without NET. Reported-by: kernel test robot Reported-by: Randy Dunlap Acked-by: Randy Dunlap Signed-off-by: Florent Revest --- include/linux/bpf.h | 1 + kernel/trace/bpf_trace.c | 22

[PATCH bpf-next v3 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-12-08 Thread Florent Revest
attachment strategy and different headers. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/socket_cookie.c | 24 +++ .../selftests/bpf/progs/socket_cookie_prog.c | 41 --- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/tools/testing

[PATCH bpf-next v3 3/4] selftests/bpf: Integrate the socket_cookie test to test_progs

2020-12-08 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/Makefile | 3 +- .../selftests/bpf/prog_tests/socket_cookie.c | 82

Re: [PATCH bpf-next v3] bpf: Only provide bpf_sock_from_file with CONFIG_NET

2020-12-08 Thread Florent Revest
On Tue, 2020-12-08 at 12:06 -0800, Randy Dunlap wrote: > On 12/8/20 9:36 AM, Florent Revest wrote: > > Acked-by: Randy Dunlap > > I would say that I didn't ack this version of the patch (hey, > it's 3x the size of the v1/v2 patches), but I have just > rebuilt with v3, so the

[PATCH bpf-next v3 1/4] bpf: Be less specific about socket cookies guarantees

2020-12-08 Thread Florent Revest
by: Daniel Borkmann Signed-off-by: Florent Revest --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 30b477a26482..ba59309f4d18 100644 ---

[PATCH bpf-next v3 2/4] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-08 Thread Florent Revest
types such as LSM. Signed-off-by: Florent Revest --- include/linux/bpf.h| 2 ++ include/uapi/linux/bpf.h | 7 +++ kernel/trace/bpf_trace.c | 4 net/core/filter.c | 24 tools/include/uapi/linux/bpf.h | 7 +++ 5 files

Re: [PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-08 Thread Florent Revest
On Fri, 2020-12-04 at 20:03 +0100, Daniel Borkmann wrote: > On 12/4/20 7:56 PM, Daniel Borkmann wrote: > > On 12/3/20 10:33 PM, Florent Revest wrote: > > > This creates a new helper proto because the existing > > > bpf_get_socket_cookie_sock_proto has a ARG_PTR_TO_

Re: [PATCH bpf-next v2 1/3] bpf: Expose bpf_get_socket_cookie to tracing programs

2020-12-08 Thread Florent Revest
On Fri, 2020-12-04 at 11:47 -0800, Martin KaFai Lau wrote: > On Thu, Dec 03, 2020 at 10:33:28PM +0100, Florent Revest wrote: > > +const struct bpf_func_proto > > bpf_get_socket_cookie_sock_tracing_proto = { > > + .func = bpf_get_socket_cookie_sock, > >

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

2021-02-10 Thread Florent Revest
On Mon, Feb 1, 2021 at 11:37 PM Alexei Starovoitov wrote: > > On Mon, Feb 1, 2021 at 2:32 PM Daniel Borkmann wrote: > > > > On 1/30/21 12:45 PM, Florent Revest wrote: > > > On Fri, Jan 29, 2021 at 1:49 PM Daniel Borkmann > > > wrote: > > >

[PATCH bpf-next v7 5/5] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-02-10 Thread Florent Revest
storage with 0xFF, this uses both an update_cookie_sockops program and an update_cookie_tracing program which succesively tag the socket with 0x0F and then 0xF0. Signed-off-by: Florent Revest Acked-by: KP Singh --- .../selftests/bpf/prog_tests/socket_cookie.c | 11 -- .../selftests/bpf/progs

[PATCH bpf-next v7 4/5] selftests/bpf: Use vmlinux.h in socket_cookie_prog.c

2021-02-10 Thread Florent Revest
e need to extract ctx->sk in a variable before checking and dereferencing it. Acked-by: KP Singh Acked-by: Andrii Nakryiko Signed-off-by: Florent Revest --- .../testing/selftests/bpf/progs/socket_cookie_prog.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tool

[PATCH bpf-next v7 1/5] bpf: Be less specific about socket cookies guarantees

2021-02-10 Thread Florent Revest
by: Daniel Borkmann Signed-off-by: Florent Revest Acked-by: KP Singh --- include/uapi/linux/bpf.h | 8 tools/include/uapi/linux/bpf.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c001766adcbc..0b

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

2021-02-10 Thread Florent Revest
This needs a new helper that: - can work in a sleepable context (using sock_gen_cookie) - takes a struct sock pointer and checks that it's not NULL Signed-off-by: Florent Revest Acked-by: KP Singh --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 8 kernel

[PATCH bpf-next v7 3/5] selftests/bpf: Integrate the socket_cookie test to test_progs

2021-02-10 Thread Florent Revest
- rewriting the server/client code with network helpers - rewriting the cgroup code with test__join_cgroup - rewriting the error handling code with CHECKs Signed-off-by: Florent Revest Acked-by: KP Singh Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf/.gitignore| 1 - tools/testing

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

2021-02-10 Thread Florent Revest
On Wed, Feb 10, 2021 at 8:52 PM Andrii Nakryiko wrote: > > On Wed, Feb 10, 2021 at 3:14 AM Florent Revest wrote: > > > > This needs a new helper that: > > - can work in a sleepable context (using sock_gen_cookie) > > - takes a struct sock pointer and checks that it

[PATCH bpf-next v2 0/6] Add a snprintf eBPF helper

2021-03-23 Thread Florent Revest
a per-cpu temporary buffer - Addressed a few cosmetic changes Florent Revest (6): bpf: Factorize bpf_trace_printk and bpf_seq_printf bpf: Add a ARG_PTR_TO_CONST_STR argument type bpf: Add a bpf_snprintf helper libbpf: Initialize the bpf_seq_printf parameters array field by field libbpf

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

2021-03-23 Thread Florent Revest
specifiers to print symbols. Signed-off-by: Florent Revest --- kernel/trace/bpf_trace.c | 529 ++- 1 file changed, 244 insertions(+), 285 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0d23755c2747..0fdca94a3c9c 100644

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

2021-03-23 Thread Florent Revest
: Add bpf_iter support") Signed-off-by: Florent Revest --- tools/lib/bpf/bpf_tracing.h | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index f9ef37707888..d9a4c3f77ff4 100644 --- a/too

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

2021-03-23 Thread Florent Revest
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. Signed-off-by: Florent Revest --- include/linux/bpf.h | 1 + kernel/bpf

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

2021-03-23 Thread Florent Revest
string validation, currently done in formatting helper calls, into the verifier logic. This makes debugging easier and also slightly improves the runtime performance. Signed-off-by: Florent Revest --- include/linux/bpf.h| 6 include/uapi/linux/bpf.h | 28

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

2021-03-23 Thread Florent Revest
This exercises most of the format specifiers when things go well. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/snprintf.c | 65 +++ .../selftests/bpf/progs/test_snprintf.c | 59 + 2 files changed, 124 insertions(+) create mode

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

2021-03-23 Thread Florent Revest
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 ++ 1 file changed, 18 insertions(+) diff --git a/tools/lib/bpf

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

2021-03-23 Thread Florent Revest
On Tue, Mar 23, 2021 at 4:21 AM Alexei Starovoitov wrote: > > On Wed, Mar 10, 2021 at 11:02:08PM +0100, Florent Revest wrote: > > > > +struct bpf_snprintf_buf { > > + char buf[MAX_SNPRINTF_MEMCPY][MAX_SNPRINTF_STR_LEN]; > > +}; > > +static DE

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

2021-04-06 Thread Florent Revest
[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: > > On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > > Unfortunatel

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

2021-04-06 Thread Florent Revest
On Fri, Mar 26, 2021 at 11:23 PM Andrii Nakryiko wrote: > On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > + > > + map_off = reg->off + reg->var_off.value; > > + err = map->ops->map_direct_value_addr(map, _addr, > >

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

2021-04-06 Thread Florent Revest
On Sat, Mar 27, 2021 at 12:05 AM Andrii Nakryiko wrote: > > 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.

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

2021-04-06 Thread Florent Revest
On Sat, Mar 27, 2021 at 12:01 AM Andrii Nakryiko wrote: > > 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

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

2021-04-06 Thread Florent Revest
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 > > helper but there are a few differences: > > > > To allow for a large

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

2021-03-16 Thread Florent Revest
On Tue, Mar 16, 2021 at 2:25 AM Andrii Nakryiko wrote: > > 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

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

2021-03-17 Thread Florent Revest
On Wed, Mar 17, 2021 at 2:02 AM Andrii Nakryiko wrote: > 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: > > >

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

2021-03-10 Thread Florent Revest
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 of pointers using this syntax: > >> __u64 array[] = { (__u64), (__u64) }; > >>

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

2021-03-10 Thread Florent Revest
relocation should be supported by libbpf but this would require a disproportionate amount of work given the actual usecases. (it is very unlikely that one uses a const array of relocated addresses) Signed-off-by: Florent Revest --- tools/lib/bpf/bpf_tracing.h | 30 +- 1 file

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

2021-03-10 Thread Florent Revest
On Wed, Mar 10, 2021 at 10:51 PM Andrii Nakryiko wrote: > 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, 202

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

2021-03-10 Thread Florent Revest
string validation, currently done in formatting helper calls, into the verifier logic. This makes debugging easier and also slightly improves the runtime performance. Signed-off-by: Florent Revest --- include/linux/bpf.h| 4 + include/uapi/linux/bpf.h | 28 +++ kernel/bpf

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

2021-03-10 Thread Florent Revest
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 +++ 1 file changed, 15 insertions(+) diff --git a/tools/lib/bpf

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

2021-03-10 Thread Florent Revest
This exercices most of the format specifiers when things go well. Signed-off-by: Florent Revest --- .../selftests/bpf/prog_tests/snprintf.c | 71 +++ .../selftests/bpf/progs/test_snprintf.c | 71 +++ 2 files changed, 142 insertions(+) create mode

[PATCH bpf-next 0/5] Add a snprintf eBPF helper

2021-03-10 Thread Florent Revest
/20210310015455.1095207-1-rev...@chromium.org/T/#u Florent Revest (5): bpf: Add a ARG_PTR_TO_CONST_STR argument type bpf: Add a bpf_snprintf helper libbpf: Initialize the bpf_seq_printf parameters array field by field libbpf: Introduce a BPF_SNPRINTF helper macro selftests/bpf: Add a series

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

2021-03-10 Thread Florent Revest
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. Signed-off-by: Florent Revest --- include/linux/bpf.h | 1 + kernel/bpf

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

2021-03-16 Thread Florent Revest
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: > > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest > > > wrote: &g

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

2021-03-16 Thread Florent Revest
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_param1(narg, x) ___param[narg - 1] = x > > +#define ___bpf_build_param2(narg, x, args...) _

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

2021-03-16 Thread Florent Revest
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) { > > + struct bpf_map *map = reg->map_ptr; > > + int map_off, i; > >

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

2021-03-09 Thread Florent Revest
=STR1 str2=STR2 ' Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/prog_tests/bug.c | 41 +++ tools/testing/selftests/bpf/progs/test_bug.c | 43 2 files changed, 84 insertions(+) create mode 100644 tools/testing/selftests/bpf/prog_tests/bug.c

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

2021-04-08 Thread Florent Revest
On Thu, Apr 8, 2021 at 12:03 AM Andrii Nakryiko wrote: > 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: > > > >

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

2021-04-08 Thread Florent Revest
On Wed, Apr 7, 2021 at 11:54 PM Andrii Nakryiko wrote: > On Tue, Apr 6, 2021 at 8:35 AM Florent Revest wrote: > > 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: [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-15 Thread Florent Revest
On Thu, Apr 15, 2021 at 12:16 AM Andrii Nakryiko wrote: > > 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 > &

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

2021-04-15 Thread Florent Revest
On Thu, Apr 15, 2021 at 12:57 AM Andrii Nakryiko wrote: > > 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

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

2021-04-15 Thread Florent Revest
On Thu, Apr 15, 2021 at 2:28 AM Andrii Nakryiko wrote: > 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. > > > > >

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

2021-04-15 Thread Florent Revest
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) > > +{ > > + struct bpf_printf_buf *bufs; > > + int used; > > + > > + if

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

2021-04-12 Thread Florent Revest
This exercises most of the format specifiers. Signed-off-by: Florent Revest Acked-by: Andrii Nakryiko --- .../selftests/bpf/prog_tests/snprintf.c | 81 +++ .../selftests/bpf/progs/test_snprintf.c | 74 + 2 files changed, 155 insertions(+) create

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

2021-04-12 Thread Florent Revest
symbols. Signed-off-by: Florent Revest --- kernel/trace/bpf_trace.c | 529 ++- 1 file changed, 248 insertions(+), 281 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 0d23755c2747..3ce9aeee6681 100644 --- a/kernel/trace

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

2021-04-12 Thread Florent Revest
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 ++ 1 file changed, 18 insertions(+) diff --git a/tools/lib/bpf

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

2021-04-12 Thread Florent Revest
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. Signed-off-by: Florent Revest --- include/linux/bpf.h | 1 + kernel/bpf

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

2021-04-12 Thread Florent Revest
of format string validation in the verifier logic. This makes debugging easier. Signed-off-by: Florent Revest --- include/linux/bpf.h| 6 include/uapi/linux/bpf.h | 28 +++ kernel/bpf/helpers.c | 2 ++ kernel/bpf/verifier.c | 41

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

2021-04-12 Thread Florent Revest
: Add bpf_iter support") Signed-off-by: Florent Revest --- tools/lib/bpf/bpf_tracing.h | 40 +++-- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index f9ef37707888..1c2e91ee041d 100644 --- a

[PATCH bpf-next v3 0/6] Add a snprintf eBPF helper

2021-04-12 Thread Florent Revest
. - bpf_snprintf's str_size can now be 0 - bpf_snprintf is now exposed to all BPF program types - We now preempt_disable when using a per-cpu temporary buffer - Addressed a few cosmetic changes Florent Revest (6): bpf: Factorize bpf_trace_printk and bpf_seq_printf bpf: Add a ARG_PTR_TO_CONST_STR

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

2021-04-19 Thread Florent Revest
: Add bpf_iter support") Signed-off-by: Florent Revest Acked-by: Andrii Nakryiko --- tools/lib/bpf/bpf_tracing.h | 40 +++-- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index f9

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

2021-04-19 Thread Florent Revest
of format string validation in the verifier logic. This makes debugging easier. Signed-off-by: Florent Revest Acked-by: Andrii Nakryiko --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 28 +++ kernel/bpf/helpers.c | 50

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

2021-04-19 Thread Florent Revest
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 Acked-by: Andrii Nakryiko --- tools/lib/bpf/bpf_tracing.h | 18 ++ 1 file changed, 18 insertions(+) diff

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

2021-04-19 Thread Florent Revest
symbols. The implementation is also moved from bpf_trace.c to helpers.c because the upcoming bpf_snprintf helper will be made available to all BPF programs and will need it. Signed-off-by: Florent Revest --- include/linux/bpf.h | 20 +++ kernel/bpf/helpers.c | 256

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

2021-04-19 Thread Florent Revest
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 | 125 ++ .../selftests/bpf/p

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

2021-04-19 Thread Florent Revest
cosmetic changes Florent Revest (6): bpf: Factorize bpf_trace_printk and bpf_seq_printf bpf: Add a ARG_PTR_TO_CONST_STR argument type bpf: Add a bpf_snprintf helper libbpf: Initialize the bpf_seq_printf parameters array field by field libbpf: Introduce a BPF_SNPRINTF helper macro

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

2021-04-19 Thread Florent Revest
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. Signed-off-by: Florent Revest Acked-by: Andrii Nakryiko --- include/linux

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

2021-04-14 Thread Florent Revest
On Wed, Apr 14, 2021 at 1:01 AM Andrii Nakryiko wrote: > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > +/* Per-cpu temp buffers which can be used by printf-like helpers for %s or > > %p > > + */ > > +#define MAX_PRINTF_BUF_LEN 512 >

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

2021-04-14 Thread Florent Revest
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. > > > > Signed-off-by: Florent Revest > > Acked-by: Andrii Nakryiko > > --- > &

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

2021-04-14 Thread Florent Revest
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, > > + struct bpf_reg_state *regs) > > +{ > > + st

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

2021-04-14 Thread Florent Revest
On Wed, Apr 14, 2021 at 11:56 AM Florent Revest wrote: > On Wed, Apr 14, 2021 at 1:01 AM Andrii Nakryiko > wrote: > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > > + err = 0; > > > +out: > > > + put_fmt_tmp_buf(); > > &

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

2021-04-14 Thread Florent Revest
On Mon, Apr 12, 2021 at 10:32 PM kernel test robot wrote: >m68k-linux-ld: kernel/bpf/verifier.o: in function > `check_helper_call.isra.0': > >> verifier.c:(.text+0xf79e): undefined reference to `bpf_printf_prepare' >m68k-linux-ld: kernel/bpf/helpers.o: in function `bpf_base_func_proto':

[PATCH] selftests/bpf: Fix the ASSERT_ERR_PTR macro

2021-04-14 Thread Florent Revest
It is just missing a ';'. This macro is not used by any test yet. Signed-off-by: Florent Revest --- tools/testing/selftests/bpf/test_progs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h

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

2021-04-14 Thread Florent Revest
of format string validation in the verifier logic. This makes debugging easier. Signed-off-by: Florent Revest --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 28 +++ kernel/bpf/helpers.c | 50 ++ kernel/bpf/verifier.c

<    1   2   3   >