Re: [PATCH v9 00/36] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph

2024-04-24 Thread Florent Revest
Neat! :) I had a look at mostly the "high level" part (fprobe and arm64 specific bits) and this seems to be in a good state to me. Thanks for all that work, that is quite a refactoring :) On Mon, Apr 15, 2024 at 2:49 PM Masami Hiramatsu (Google) wrote: > > Hi, > > Here is the 9th version of the

Re: [PATCH v9 01/36] tracing: Add a comment about ftrace_regs definition

2024-04-24 Thread Florent Revest
On Wed, Apr 24, 2024 at 2:23 PM Florent Revest wrote: > > On Mon, Apr 15, 2024 at 2:49 PM Masami Hiramatsu (Google) > wrote: > > > > From: Masami Hiramatsu (Google) > > > > To clarify what will be expected on ftrace_regs, add a comment to the > > arc

Re: [PATCH v9 01/36] tracing: Add a comment about ftrace_regs definition

2024-04-24 Thread Florent Revest
On Mon, Apr 15, 2024 at 2:49 PM Masami Hiramatsu (Google) wrote: > > From: Masami Hiramatsu (Google) > > To clarify what will be expected on ftrace_regs, add a comment to the > architecture independent definition of the ftrace_regs. > > Signed-off-by: Masami Hiramatsu (Google) > Acked-by: Mark R

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

2021-04-20 Thread Florent Revest
On Tue, Apr 20, 2021 at 12:54 AM Alexei Starovoitov wrote: > > On Mon, Apr 19, 2021 at 05:52:39PM +0200, 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 t

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

2021-04-20 Thread Florent Revest
On Mon, Apr 19, 2021 at 9:34 PM Andrii Nakryiko wrote: > > On Mon, Apr 19, 2021 at 8:52 AM Florent Revest wrote: > > > > We have a usecase where we want to audit symbol names (if available) in > > callback registration hooks. (ex: fentry/nf_register_net_hook) >

[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 3/6] bpf: Add a bpf_snprintf helper

2021-04-19 Thread Florent Revest
ss 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

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

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

2021-04-19 Thread Florent Revest
ssed 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: Introduce a BPF_SNPRINTF he

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

2021-04-16 Thread Florent Revest
On Fri, Apr 16, 2021 at 1:20 AM Andrii Nakryiko wrote: > > On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > +/* Loads an eBPF object calling bpf_snprintf with up to 10 characters of > > fmt */ > > +static int load_single_snprintf(char *fmt) &

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

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

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

2021-04-14 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 v4 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-14 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 | 124 ++ .../selftests/bpf/p

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

2021-04-14 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 v4 3/6] bpf: Add a bpf_snprintf helper

2021-04-14 Thread Florent Revest
ss 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/verif

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

2021-04-14 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

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

2021-04-14 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 | 254

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

2021-04-14 Thread Florent Revest
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 argument type bpf: Add a bpf_snprintf helper libbpf: Initialize the bpf_seq_printf

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

2021-04-14 Thread Florent Revest
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 Revest wrote: > > > + fmt = (char *)fmt_addr + fmt_map_off; > > > + > > &g

[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/te

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

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

[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
lpers. - 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

[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 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 3/6] bpf: Add a bpf_snprintf helper

2021-04-12 Thread Florent Revest
ss 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

[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

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 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 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 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 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 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, &map_addr, >

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: > > > Unfortunately,

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

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

2021-03-23 Thread Florent Revest
ormat 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

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

2021-03-23 Thread Florent Revest
ing 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 l

[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 --- a

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 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: [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 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; > >

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 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: [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, 2021 at 6:16 AM

[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 of

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

2021-03-10 Thread Florent Revest
ormat 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 +++ kerne

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

[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 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)&var1, (__u64)&var

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

2021-03-09 Thread Florent Revest
= str1=STR1 str2=STR2 ' != expected 'str1=STR1 str2=STR2 str1=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,

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 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
fore, we 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 --

[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 k

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

2021-02-10 Thread Florent Revest
etons - 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/te

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

2021-02-10 Thread Florent Revest
rted-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 c001766adcb

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

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

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

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

2021-01-26 Thread Florent Revest
fore, we 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/

[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

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

2021-01-26 Thread Florent Revest
etons - 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/Mak

[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 k

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

2021-01-26 Thread Florent Revest
rted-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 c001766adcb

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 v5 4/4] selftests/bpf: Add a selftest for the tracing bpf_get_socket_cookie

2021-01-22 Thread Florent Revest
On Wed, Jan 20, 2021 at 8:06 PM Florent Revest wrote: > > On Wed, Jan 20, 2021 at 8:04 PM Alexei Starovoitov > wrote: > > > > On Wed, Jan 20, 2021 at 9:08 AM KP Singh wrote: > > > > > > On Tue, Jan 19, 2021 at 5:00 PM Florent Revest > > > wrote

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

2021-01-22 Thread Florent Revest
On Thu, Jan 21, 2021 at 8:55 AM Andrii Nakryiko wrote: > > On Tue, Jan 19, 2021 at 8:00 AM Florent Revest wrote: > > > > Currently, the selftest for the BPF socket_cookie helpers is built and > > run independently from test_progs. It's easy to forget and hard to >

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

2021-01-20 Thread Florent Revest
On Wed, Jan 20, 2021 at 8:04 PM Alexei Starovoitov wrote: > > On Wed, Jan 20, 2021 at 9:08 AM KP Singh wrote: > > > > On Tue, Jan 19, 2021 at 5:00 PM Florent Revest wrote: > > > > > > This builds up on the existing socket cookie test which checks whether >

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

2021-01-19 Thread Florent Revest
On Wed, Dec 9, 2020 at 5:35 PM Daniel Borkmann wrote: > > On 12/9/20 2:26 PM, Florent Revest wrote: > > This needs two new helpers, one that works in a sleepable context (using > > sock_gen_cookie which disables/enables preemption) and one that does not > > (for performan

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

2021-01-19 Thread Florent Revest
etons - 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

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

2021-01-19 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 v5 1/4] bpf: Be less specific about socket cookies guarantees

2021-01-19 Thread Florent Revest
rted-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 c001766adcbc..0b735c2729b2 10064

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

2021-01-19 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 --- include/linux/bpf.h| 1 + include/uapi/linux/bpf.h | 8 kernel/trace/bpf_tr

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

2020-12-22 Thread Florent Revest
On Fri, Dec 18, 2020 at 4:20 AM Alexei Starovoitov wrote: > As far as 6 arg issue: > long bpf_snprintf(const char *out, u32 out_size, > const char *fmt, u32 fmt_size, > const void *data, u32 data_len); > Yeah. It won't work as-is, but fmt_size is unnecessary now

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

2020-12-22 Thread Florent Revest
wrote: > > > > > > > > On Thu, Dec 17, 2020 at 09:26:09AM -0800, Yonghong Song wrote: > > > > > > > > > > > > > > > On 12/17/20 7:31 AM, Florent Revest wrote: > > > > > > On Mon, Dec 14, 2020 at 7:47 AM Yonghon

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

2020-12-22 Thread Florent Revest
On Tue, Dec 22, 2020 at 3:18 PM Christoph Hellwig wrote: > > FYI, there is a reason why kallsyms_lookup is not exported any more. > I don't think adding that back through a backdoor is a good idea. Did you maybe mean kallsyms_lookup_name (the one that looks an address up based on a symbol name) ?

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

2020-12-17 Thread Florent Revest
On Mon, Dec 14, 2020 at 7:47 AM Yonghong Song wrote: > On 12/11/20 6:40 AM, Florent Revest wrote: > > On Wed, Dec 2, 2020 at 10:18 PM Alexei Starovoitov > > wrote: > >> I still think that adopting printk/vsnprintf for this instead of > >> reinventing the wheel &g

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

2020-12-11 Thread Florent Revest
On Wed, Dec 2, 2020 at 10:18 PM Alexei Starovoitov wrote: > I still think that adopting printk/vsnprintf for this instead of > reinventing the wheel > is more flexible and easier to maintain long term. > Almost the same layout can be done with vsnprintf > with exception of \0 char. > More meaningf

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

2020-12-09 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 v4 1/4] bpf: Be less specific about socket cookies guarantees

2020-12-09 Thread Florent Revest
rted-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 10064

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

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

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

2020-12-09 Thread Florent Revest
etons - 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

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

2020-12-09 Thread Florent Revest
On Tue, 2020-12-08 at 23:08 +0100, KP Singh wrote: > My understanding is you can simply always call sock_gen_cookie and > not have two protos. > > This will disable preemption in sleepable programs and not have any > effect in non-sleepable programs since preemption will already be > disabled. Su

  1   2   >