Re: [PATCH] net: bpf: type fixes for __be16/__be32

2019-10-17 Thread Martin Lau
On Wed, Oct 16, 2019 at 12:16:35PM +0100, Ben Dooks (Codethink) wrote: > In bpf_skb_load_helper_8_no_cache and > bpf_skb_load_helper_16_no_cache they > read a u16/u32 where actually these > are __be16 and __be32. > > Fix the following by making the types > match: > > net/core/filter.c:215:32:

Re: [PATCH bpf-next] bpf: sk_storage: Fix out of bounds memory access

2019-06-13 Thread Martin Lau
On Thu, Jun 13, 2019 at 10:15:38AM -0700, Andrii Nakryiko wrote: > On Thu, Jun 13, 2019 at 8:16 AM Arthur Fabre wrote: > > > > bpf_sk_storage maps use multiple spin locks to reduce contention. > > The number of locks to use is determined by the number of possible CPUs. > > With only 1 possible

Re: [PATCH bpf-next] bpf: allow CGROUP_SKB programs to use bpf_skb_cgroup_id() helper

2019-06-06 Thread Martin Lau
On Thu, Jun 06, 2019 at 01:30:12PM -0700, Roman Gushchin wrote: > Currently bpf_skb_cgroup_id() is not supported for CGROUP_SKB > programs. An attempt to load such a program generates an error > like this: > > libbpf: > 0: (b7) r6 = 0 > ... > 9: (85) call bpf_skb_cgroup_id#79 >

Re: [PATCH][next] bpf: hbm: fix spelling mistake "notifcations" -> "notificiations"

2019-06-03 Thread Martin Lau
On Mon, Jun 03, 2019 at 02:36:53PM +0100, Colin King wrote: > From: Colin Ian King > > There is a spelling mistake in the help information, fix this. > > Signed-off-by: Colin Ian King > --- > samples/bpf/hbm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH v3 net] ipv6: Fix dangling pointer when ipv6 fragment

2019-04-02 Thread Martin Lau
On Tue, Apr 02, 2019 at 06:49:03PM +0800, kbuild test robot wrote: > Hi hujunwei, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on net/master] > > url: >

Re: [PATCH] bpf: drop refcount if bpf_map_new_fd() fails in map_create()

2019-02-27 Thread Martin Lau
On Wed, Feb 27, 2019 at 10:36:25PM +0800, zerons wrote: > In bpf/syscall.c, map_create() first set map->usercnt to 1, a file descriptor > is > supposed to return to userspace. When bpf_map_new_fd() fails, drop the > refcount. Thanks for the patch. Please add a Fixes tag for bug fix in the

Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()

2019-02-26 Thread Martin Lau
On Tue, Feb 26, 2019 at 10:15:37PM +0800, zerons wrote: > [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ] > > In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to > increase > the refcount, both map->refcnt and map->usercnt. Then, if bpf_map_new_fd() > fails, >

Re: [PATCH bpf-next v1] bpf, lpm: fix lookup bug in map_delete_elem

2019-02-21 Thread Martin Lau
On Thu, Feb 21, 2019 at 05:39:26PM +0100, Alban Crequy wrote: > From: Alban Crequy > > trie_delete_elem() was deleting an entry even though it was not matching > if the prefixlen was correct. This patch adds a check on matchlen. > > Reproducer: > > $ sudo bpftool map create /sys/fs/bpf/mylpm

Re: [RFC] Loading BTF and pretty printing maps with bpftool

2019-01-25 Thread Martin Lau
On Fri, Jan 25, 2019 at 11:20:57AM +0100, Arnaldo Carvalho de Melo wrote: > # bpftool version > bpftool v5.0.0-rc3 > # > > # bpftool prog | tail -6 > 309: tracepoint name sys_enter tag 819967866022f1e1 gpl > loaded_at 2019-01-25T11:05:41+0100 uid 0 > xlated 528B jited

Re: [PATCH] bpf: Make function btf_name_offset_valid static

2019-01-16 Thread Martin Lau
On Wed, Jan 16, 2019 at 08:29:40PM +0100, Mathieu Malaterre wrote: > Initially in commit 69b693f0aefa ("bpf: btf: Introduce BPF Type Format > (BTF)") the function 'btf_name_offset_valid' was introduced as static > function it was later on changed to a non-static one, and then finally > in commit

Re: "bpf: Improve the info.func_info and info.func_info_rec_size behavior" breaks strace self tests

2019-01-03 Thread Martin Lau
On Thu, Jan 03, 2019 at 11:41:18PM +0100, Heiko Carstens wrote: > On Thu, Jan 03, 2019 at 07:12:05PM +0000, Martin Lau wrote: > > On Thu, Jan 03, 2019 at 12:46:13PM +0100, Heiko Carstens wrote: > > > Hello, > > > > > > the kernel commit 7337224fc1

Re: "bpf: Improve the info.func_info and info.func_info_rec_size behavior" breaks strace self tests

2019-01-03 Thread Martin Lau
On Thu, Jan 03, 2019 at 12:46:13PM +0100, Heiko Carstens wrote: > Hello, > > the kernel commit 7337224fc150 ("bpf: Improve the info.func_info and > info.func_info_rec_size behavior") breaks one of strace's self tests: > > FAIL: bpf-obj_get_info_by_fd-prog-v.gen The strace's

Re: [PATCH bpf-next v2] bpf: support raw tracepoints in modules

2018-12-13 Thread Martin Lau
On Thu, Dec 13, 2018 at 11:38:51AM -0800, Matt Mullins wrote: > On Thu, 2018-12-13 at 19:22 +0000, Martin Lau wrote: > > On Wed, Dec 12, 2018 at 04:42:37PM -0800, Matt Mullins wrote: > > > Distributions build drivers as modules, including network and filesystem > > > dr

Re: [PATCH bpf-next v2] bpf: support raw tracepoints in modules

2018-12-13 Thread Martin Lau
On Wed, Dec 12, 2018 at 04:42:37PM -0800, Matt Mullins wrote: > Distributions build drivers as modules, including network and filesystem > drivers which export numerous tracepoints. This enables > bpf(BPF_RAW_TRACEPOINT_OPEN) to attach to those tracepoints. > > Signed-off-by: Matt Mullins > ---

Re: [PATCH v2 bpf-next 3/3] selftests/bpf: add btf annotations for cgroup_local_storage maps

2018-12-11 Thread Martin Lau
On Mon, Dec 10, 2018 at 03:43:02PM -0800, Roman Gushchin wrote: > Add btf annotations to cgroup local storage maps (per-cpu and shared) > in the network packet counting example. Acked-by: Martin KaFai Lau

Re: [PATCH v2 bpf-next 2/3] bpf: add bpffs pretty print for cgroup local storage maps

2018-12-11 Thread Martin Lau
On Mon, Dec 10, 2018 at 03:43:01PM -0800, Roman Gushchin wrote: > Implement bpffs pretty printing for cgroup local storage maps > (both shared and per-cpu). > Output example (captured for tools/testing/selftests/bpf/netcnt_prog.c): > > Shared: > $ cat /sys/fs/bpf/map_2 > # WARNING!! The

Re: [PATCH bpf-next 1/3] bpf: pass struct btf pointer to the map_check_btf() callback

2018-12-08 Thread Martin Lau
On Fri, Dec 07, 2018 at 04:53:13PM -0800, Roman Gushchin wrote: > If key_type or value_type are of non-trivial data types > (e.g. structure or typedef), it's not possible to check them without > the additional information, which can't be obtained without a pointer > to the btf structure. > > So,

Re: [PATCH bpf-next 2/3] bpf: add bpffs pretty print for cgroup local storage maps

2018-12-08 Thread Martin Lau
On Fri, Dec 07, 2018 at 04:53:14PM -0800, Roman Gushchin wrote: > Implement bpffs pretty printing for cgroup local storage maps > (both shared and per-cpu). > Output example (captured for tools/testing/selftests/bpf/netcnt_prog.c): > > Shared: > $ cat /sys/fs/bpf/map_2 > # WARNING!! The

RE: [PATCH RESEND] tcp_estats: ebpf hacks

2016-02-03 Thread Martin Lau
Please ignore. It is a mistake... From: Martin KaFai Lau [ka...@fb.com] Sent: Wednesday, February 03, 2016 9:39 PM To: linux-kernel@vger.kernel.org Cc: Ingo Molnar; Masami Hiramatsu; Steven Rostedt; Alexei Starovoitov; Josef Bacik; Kernel Team Subject:

RE: [PATCH RESEND] tcp_estats: ebpf hacks

2016-02-03 Thread Martin Lau
Please ignore. It is a mistake... From: Martin KaFai Lau [ka...@fb.com] Sent: Wednesday, February 03, 2016 9:39 PM To: linux-kernel@vger.kernel.org Cc: Ingo Molnar; Masami Hiramatsu; Steven Rostedt; Alexei Starovoitov; Josef Bacik; Kernel Team Subject:

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-07-15 Thread Martin Lau
Yes, I think it should go to both stable and 3.16. Thanks, --Martin On Tue, Jul 15, 2014 at 03:46:12PM -0400, Steven Rostedt wrote: > On Thu, 10 Jul 2014 15:20:30 -0700 > Martin Lau wrote: > > > Hi Steve, > > > > Do you have a chance to give it another try? > &g

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-07-15 Thread Martin Lau
Yes, I think it should go to both stable and 3.16. Thanks, --Martin On Tue, Jul 15, 2014 at 03:46:12PM -0400, Steven Rostedt wrote: On Thu, 10 Jul 2014 15:20:30 -0700 Martin Lau ka...@fb.com wrote: Hi Steve, Do you have a chance to give it another try? OK, I finally got around

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-07-10 Thread Martin Lau
Hi Steve, Do you have a chance to give it another try? Thanks, Martin On Thu, Jun 26, 2014 at 11:52:44PM -0700, Martin Lau wrote: > Hi Steve, > > I retried the test program (with the kernel patch). It does block from > time to time. I spotted the ee.events is not set to EP

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-07-10 Thread Martin Lau
Hi Steve, Do you have a chance to give it another try? Thanks, Martin On Thu, Jun 26, 2014 at 11:52:44PM -0700, Martin Lau wrote: Hi Steve, I retried the test program (with the kernel patch). It does block from time to time. I spotted the ee.events is not set to EPOLLIN before calling

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-27 Thread Martin Lau
in case if it still blocks). Can you retry? Thanks, Martin On Thu, Jun 26, 2014 at 08:53:27PM -0400, Steven Rostedt wrote: > On Thu, 26 Jun 2014 11:34:46 -0700 > Martin Lau wrote: > > > Hi Steve, > > > > Can the modified test program reproduce the problem in you

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-27 Thread Martin Lau
in case if it still blocks). Can you retry? Thanks, Martin On Thu, Jun 26, 2014 at 08:53:27PM -0400, Steven Rostedt wrote: On Thu, 26 Jun 2014 11:34:46 -0700 Martin Lau ka...@fb.com wrote: Hi Steve, Can the modified test program reproduce the problem in your test setup? Ah sorry

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-26 Thread Martin Lau
Hi Steve, Can the modified test program reproduce the problem in your test setup? Thanks, --Martin On Tue, Jun 10, 2014 at 10:58:14PM -0700, Martin Lau wrote: > Hi Steve, > > Attached is the modified test program. Here is the sample output: > > localhost ~ # ./ftrace-t

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-26 Thread Martin Lau
Hi Steve, Can the modified test program reproduce the problem in your test setup? Thanks, --Martin On Tue, Jun 10, 2014 at 10:58:14PM -0700, Martin Lau wrote: Hi Steve, Attached is the modified test program. Here is the sample output: localhost ~ # ./ftrace-test-epoll-kafai

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-10 Thread Martin Lau
, 2014 at 11:49:15AM -0400, Steven Rostedt wrote: > On Mon, 9 Jun 2014 23:06:42 -0700 > Martin Lau wrote: > > > ring_buffer_poll_wait() should always put the poll_table to its wait_queue > > even there is immediate data available. Otherwise, the following epoll and > > r

[PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-10 Thread Martin Lau
in tcp.c. Signed-off-by: Martin Lau --- kernel/trace/ring_buffer.c | 4 1 file changed, 4 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index fd12cc5..a6e64e8 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -613,10 +613

[PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-10 Thread Martin Lau
. Signed-off-by: Martin Lau ka...@fb.com --- kernel/trace/ring_buffer.c | 4 1 file changed, 4 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index fd12cc5..a6e64e8 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -613,10 +613,6 @@ int

Re: [PATCH] ring-buffer: Fix polling on trace_pipe

2014-06-10 Thread Martin Lau
, 2014 at 11:49:15AM -0400, Steven Rostedt wrote: On Mon, 9 Jun 2014 23:06:42 -0700 Martin Lau ka...@fb.com wrote: ring_buffer_poll_wait() should always put the poll_table to its wait_queue even there is immediate data available. Otherwise, the following epoll and read sequence