Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-22 Thread John Fastabend
Andrii Nakryiko wrote: > On Mon, Jun 22, 2020 at 12:42 PM John Fastabend > wrote: > > > > Andrii Nakryiko wrote: > > > On Mon, Jun 22, 2020 at 11:30 AM John Fastabend > > > wrote: > > > > > > > > Andrii Nakryiko wrote: > > >

Re: [PATCH bpf v2] restore behaviour of CAP_SYS_ADMIN allowing the loading of networking bpf programs

2020-06-22 Thread John Stultz
N but not SYS_ADMIN). > > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Reported-by: John Stultz > Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF") > Signed-off-by: Maciej Żenczykowski Thanks so much for helping narrow this regression down and submitting this fix! It's much appreciated! Tested-by: John Stultz thanks -john

Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-22 Thread John Fastabend
Andrii Nakryiko wrote: > On Mon, Jun 22, 2020 at 11:30 AM John Fastabend > wrote: > > > > Andrii Nakryiko wrote: > > > On Fri, Jun 19, 2020 at 3:21 PM Daniel Borkmann > > > wrote: > > > > > > > > On 6/19/20 8:41 PM, Andrii Nakr

Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-22 Thread John Fastabend
Andrii Nakryiko wrote: > On Fri, Jun 19, 2020 at 3:21 PM Daniel Borkmann wrote: > > > > On 6/19/20 8:41 PM, Andrii Nakryiko wrote: > > > On Fri, Jun 19, 2020 at 6:08 AM Daniel Borkmann > > > wrote: > > >> On 6/19/20 2:39 AM, John Fastabend wrote:

Re: [PATCH] bpf: Allow small structs to be type of function argument

2020-06-19 Thread John Fastabend
Yonghong Song wrote: > > > On 6/18/20 7:04 PM, Alexei Starovoitov wrote: > > On Thu, Jun 18, 2020 at 5:26 PM John Fastabend > > wrote: > >> > >> foo(int a, __int128 b) > >> > >> would put a in r0 and b in r2 and r3 leaving a hole in r

Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-18 Thread John Fastabend
John Fastabend wrote: > Andrii Nakryiko wrote: > > On Thu, Jun 18, 2020 at 11:58 AM John Fastabend > > wrote: [...] > > That would be great. Self-tests do work, but having more testing with > > real-world application would certainly help as well. > > Thanks

Re: [PATCH] bpf: Allow small structs to be type of function argument

2020-06-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, Jun 18, 2020 at 3:50 PM John Fastabend > wrote: > > > > Jiri Olsa wrote: > > > On Wed, Jun 17, 2020 at 04:20:54PM -0700, John Fastabend wrote: > > > > Jiri Olsa wrote: > > > > > This way we can have trampoli

Re: [PATCH bpf 2/2] selftests/bpf: add variable-length data concatenation pattern test

2020-06-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, Jun 18, 2020 at 12:09 PM John Fastabend > wrote: > > > > Andrii Nakryiko wrote: > > > Add selftest that validates variable-length data reading and > > > concatentation > > > with one big shared data array. This is

Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, Jun 18, 2020 at 11:58 AM John Fastabend > wrote: > > > > Andrii Nakryiko wrote: > > > On Wed, Jun 17, 2020 at 11:49 PM John Fastabend > > > wrote: > > > > > > > > Andrii Nakryiko wrote: > > >

Re: [PATCH] bpf: Allow small structs to be type of function argument

2020-06-18 Thread John Fastabend
Jiri Olsa wrote: > On Wed, Jun 17, 2020 at 04:20:54PM -0700, John Fastabend wrote: > > Jiri Olsa wrote: > > > This way we can have trampoline on function > > > that has arguments with types like: > > > > > > kuid_t uid > > > kgid_t

RE: [PATCH 02/11] bpf: Compile btfid tool at kernel compilation start

2020-06-18 Thread John Fastabend
John Fastabend wrote: > Jiri Olsa wrote: > > The btfid tool will be used during the vmlinux linking, > > so it's necessary it's ready for it. > > > > Signed-off-by: Jiri Olsa > > --- > > Makefile | 22 ++ > > t

RE: [PATCHv3 0/9] bpf: Add d_path helper

2020-06-18 Thread John Fastabend
going to nitpick if its in this series or a stand-alone patch but do want to see it. So far the Documentation on BTF is fairly good and I want to avoid these kind of gaps. Thanks! John

RE: [PATCH 02/11] bpf: Compile btfid tool at kernel compilation start

2020-06-18 Thread John Fastabend
@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include Here is the error. Is it something about my setup? bpftool/btf.c uses . Because this in top-level Makefile we probably don't want to push extra setup onto folks. In file included from btfid.c:51: /

RE: [PATCH bpf 2/2] selftests/bpf: add variable-length data concatenation pattern test

2020-06-18 Thread John Fastabend
Andrii Nakryiko wrote: > Add selftest that validates variable-length data reading and concatentation > with one big shared data array. This is a common pattern in production use for > monitoring and tracing applications, that potentially can read a lot of data, > but usually reads much less. Such p

Re: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Wed, Jun 17, 2020 at 11:49 PM John Fastabend > wrote: > > > > Andrii Nakryiko wrote: > > > Switch most of BPF helper definitions from returning int to long. These > > > definitions are coming from comments in BPF UAPI h

RE: [PATCH bpf-next 1/2] bpf: switch most helper return values from 32-bit int to 64-bit long

2020-06-17 Thread John Fastabend
Andrii Nakryiko wrote: > Switch most of BPF helper definitions from returning int to long. These > definitions are coming from comments in BPF UAPI header and are used to > generate bpf_helper_defs.h (under libbpf) to be later included and used from > BPF programs. > > In actual in-kernel implemen

RE: [PATCH bpf-next] bpf: sk_storage: Prefer to get a free cache_idx

2020-06-17 Thread John Fastabend
Martin KaFai Lau > --- > net/core/bpf_sk_storage.c | 41 +++ > 1 file changed, 37 insertions(+), 4 deletions(-) > Acked-by: John Fastabend

RE: [PATCH bpf-next v4 3/3] bpf: add SO_KEEPALIVE and related options to bpf_setsockopt

2020-06-17 Thread John Fastabend
l-doc (Nikita Vetoshkin ) > > Signed-off-by: Dmitry Yakunin > Acked-by: Martin KaFai Lau > --- Acked-by: John Fastabend

RE: [PATCH bpf-next v4 1/3] sock: move sock_valbool_flag to header

2020-06-17 Thread John Fastabend
Dmitry Yakunin wrote: > This is preparation for usage in bpf_setsockopt. > > Signed-off-by: Dmitry Yakunin > Acked-by: Martin KaFai Lau > --- Acked-by: John Fastabend

RE: [PATCH bpf-next v4 1/3] sock: move sock_valbool_flag to header

2020-06-17 Thread John Fastabend
Dmitry Yakunin wrote: > This is preparation for usage in bpf_setsockopt. > > Signed-off-by: Dmitry Yakunin > Acked-by: Martin KaFai Lau > --- Acked-by: John Fastabend

RE: [PATCH] bpf: Allow small structs to be type of function argument

2020-06-17 Thread John Fastabend
Jiri Olsa wrote: > This way we can have trampoline on function > that has arguments with types like: > > kuid_t uid > kgid_t gid > > which unwind into small structs like: > > typedef struct { > uid_t val; > } kuid_t; > > typedef struct { > gid_t val; > } kgid_t; > >

Re: [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags

2020-06-16 Thread John Fastabend
sockmap and flow_dissector have the same semantics as cgroup > > > > and lirc2 requires a bunch of changes (probably a new function for > > > > sockmap) > > > > > > making flow dissector pass prog_fd as cg and lirc is certainly my > > > preference. > > > Especially since tests are passing fd user code is likely doing the same, > > > so breakage is unlikely. Also it wasn't done that long ago, so > > > we can backport far enough. > > > It will remove cap_net_admin ugly check in bpf_prog_detach() > > > which is the only exception now in cap model. > > > > SGTM. What about sockmap though? The code for that has been around for ages. > > you mean the second patch that enforces sock_map_get_from_fd doesn't > use attach_flags? > I think it didn't break anything, so enforcing is fine. I'm ok with enforcing it. > > or the detach part that doesn't use prog_fd ? > I'm not sure what's the best here. > At least from cap perspective it's fine because map_fd is there. > > John, wdyt? I think we can keep the current detach without the prog_fd as-is. And then add logic so that if the prog_fd is included we check it?

RE: [PATCH bpf] devmap: use bpf_map_area_alloc() for allocating hash buckets

2020-06-16 Thread John Fastabend
> kernel/bpf/devmap.c | 10 ++ > 1 file changed, 6 insertions(+), 4 deletions(-) > Acked-by: John Fastabend

Re: [PATCH bpf] xdp: handle frame_sz in xdp_convert_zc_to_xdp_frame()

2020-06-16 Thread John Fastabend
t; > > Fixes: 34cc0b338a61 ("xdp: Xdp_frame add member frame_sz and handle in > > convert_to_xdp_frame") > > Signed-off-by: Hangbin Liu > > Thanks for spotting and fixing this! :-) > > Acked-by: Jesper Dangaard Brouer > Acked-by: John Fastabend

RE: [PATCH] [bpf] xdp_redirect_cpu_user: Fix null pointer dereference

2020-06-16 Thread John Fastabend
emset(rec, 0, size); > + rec = calloc(n_cpus + 1, sizeof(struct record)); > if (!rec) { > fprintf(stderr, "Mem alloc error\n"); > exit(EXIT_FAIL_MEM); > -- > 2.17.1 > Acked-by: John Fastabend

RE: [PATCH] [bpf] xdp_monitor_user: Fix null pointer dereference

2020-06-16 Thread John Fastabend
/* Alloc main stats_record structure */ > - rec = malloc(sizeof(*rec)); > - memset(rec, 0, sizeof(*rec)); > + rec = calloc(1, sizeof(*rec)); > if (!rec) { > fprintf(stderr, "Mem alloc error\n"); > exit(EXIT_FAIL_MEM); > -- > 2.17.1 > Acked-by: John Fastabend

RE: [PATCH bpf 1/2] bpf: bpf_probe_read_kernel_str() has to return amount of data read on success

2020-06-16 Thread John Fastabend
fe_ptr) > if (unlikely(ret < 0)) > goto fail; > > - return 0; > + return ret; > fail: > memset(dst, 0, size); > return ret; > -- > 2.24.1 > Acked-by: John Fastabend

Re: [PATCH] xdp_rxq_info_user: Fix null pointer dereference. Replace malloc/memset with calloc.

2020-06-12 Thread John Fastabend
h a calloc() > > > > Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to > > xdp_rxq_info") > > Signed-off-by: Gaurav Singh > > Acked-by: Jesper Dangaard Brouer > Acked-by: John Fastabend

Re: [PATCH bpf] bpf: sockmap: don't attach programs to UDP sockets

2020-06-12 Thread John Fastabend
DP; > > } > > > > +static bool sock_map_redirect_allowed(const struct sock *sk) > > +{ > > + return sk_is_tcp(sk) && sk->sk_state != TCP_LISTEN; > > +} > > + > > static bool sock_map_sk_is_suitable(const struct sock *sk) > > { > > return sk_is_tcp(sk) || sk_is_udp(sk); > > Acked-by: Jakub Sitnicki Thanks. Acked-by: John Fastabend

Re: [PATCH bpf] bpf: tcp: recv() should return 0 when the peer socket is closed

2020-06-12 Thread John Fastabend
Alexei Starovoitov wrote: > On Fri, Jun 12, 2020 at 3:18 AM Jakub Sitnicki wrote: > > > > On Wed, 10 Jun 2020 12:19:43 +0200 > > Sabrina Dubroca wrote: > > > > > If the peer is closed, we will never get more data, so > > > tcp_bpf_wait_data will get stuck forever. In case we passed > > > MSG_DONT

Re: [PATCH 1/2] docs: mm/gup: pin_user_pages.rst: add a "case 5"

2020-06-12 Thread John Hubbard
On 2020-06-12 12:24, Matthew Wilcox wrote: On Fri, May 29, 2020 at 04:43:08PM -0700, John Hubbard wrote: +CASE 5: Pinning in order to write to the data within the page +- +Even though neither DMA nor Direct IO is involved, just a

Re: [PATCH bpf 2/2] bpf, sockhash: Synchronize delete from bucket list on map free

2020-06-09 Thread John Fastabend
Alexei Starovoitov wrote: > On Tue, Jun 9, 2020 at 10:51 AM John Fastabend > wrote: > > > > Jakub Sitnicki wrote: > > > We can end up modifying the sockhash bucket list from two CPUs when a > > > sockhash is being destroyed (sock_hash_free) on one CPU,

RE: [PATCH bpf 2/2] bpf, sockhash: Synchronize delete from bucket list on map free

2020-06-09 Thread John Fastabend
so that we can unlink the socket from the map when > holding the sock lock. > > Fixes: 90db6d772f74 ("bpf, sockmap: Remove bucket->lock from > sock_{hash|map}_free") > Reported-by: Eric Dumazet > Signed-off-by: Jakub Sitnicki > --- > net/core/sock_map.c | 23 +-- > 1 file changed, 21 insertions(+), 2 deletions(-) Thanks. Acked-by: John Fastabend

RE: [PATCH bpf 1/2] bpf, sockhash: Fix memory leak when unlinking sockets in sock_hash_free

2020-06-09 Thread John Fastabend
sock_hash_free_elem(htab, elem); > } > } > > -- > 2.25.4 > In Cilium we pin the map and never release it thanks for catching this. Acked-by: John Fastabend

RE: [PATCH] bpf/sockmap: fix kernel panic at __tcp_bpf_recvmsg

2020-06-08 Thread John Fastabend
__audit_syscall_exit+0x1e4/0x290 > [20759.307235] __x64_sys_recvfrom+0x24/0x30 > [20759.312226] do_syscall_64+0x55/0x1b0 > [20759.316852] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > Signed-off-by: dihu > --- > net/ipv4/tcp_bpf.c | 3 +++ > 1 file changed, 3 insertions(+) > Thanks, looks good to me. Acked-by: John Fastabend

ethtool 5.7 released

2020-06-04 Thread John W. Linville
responsibility, and I have every confidence that he will do a great job in that capacity for our community. Thanks, Michal! John -- John W. LinvilleSomeday the world will need a hero, and you linvi...@tuxdriver.com might be all we have. Be ready.

Re: [bpf PATCH] bpf: sockmap, remove bucket->lock from sock_{hash|map}_free

2020-06-03 Thread John Fastabend
Jakub Sitnicki wrote: > On Wed, Jun 03, 2020 at 08:35 PM CEST, John Fastabend wrote: > > Jakub Sitnicki wrote: > > [...] > > >> I'm not sure that the check for map->refcnt when sock is unlinking > >> itself from the map will do it. I worry we will then

Re: [bpf PATCH] bpf: sockmap, remove bucket->lock from sock_{hash|map}_free

2020-06-03 Thread John Fastabend
Jakub Sitnicki wrote: > On Wed, Jun 03, 2020 at 08:13 AM CEST, Eric Dumazet wrote: > > On 3/10/20 9:41 AM, John Fastabend wrote: > >> The bucket->lock is not needed in the sock_hash_free and sock_map_free > >> calls, in fact it is causing a splat due to being inside r

Re: [bpf-next PATCH 2/3] bpf: fix running sk_skb program types with ktls

2020-06-01 Thread John Fastabend
John Fastabend wrote: > Jakub Sitnicki wrote: > > On Fri, 29 May 2020 16:06:59 -0700 > > John Fastabend wrote: > > > > > KTLS uses a stream parser to collect TLS messages and send them to > > > the upper layer tls receive handler. This ensures the tls

Re: [bpf-next PATCH 2/3] bpf: fix running sk_skb program types with ktls

2020-06-01 Thread John Fastabend
Jakub Sitnicki wrote: > On Fri, 29 May 2020 16:06:59 -0700 > John Fastabend wrote: > > > KTLS uses a stream parser to collect TLS messages and send them to > > the upper layer tls receive handler. This ensures the tls receiver > > has a full TLS header to parse when

Re: [bpf-next PATCH 1/3] bpf: refactor sockmap redirect code so its easy to reuse

2020-06-01 Thread John Fastabend
Jakub Sitnicki wrote: > On Fri, 29 May 2020 16:06:41 -0700 > John Fastabend wrote: > > > We will need this block of code called from tls context shortly > > lets refactor the redirect logic so its easy to use. This also > > cleans up the switch stmt so we h

[PATCH v2 2/2] vhost: convert get_user_pages() --> pin_user_pages()

2020-05-31 Thread John Hubbard
07108/ Cc: Michael S. Tsirkin Cc: Jason Wang Cc: k...@vger.kernel.org Cc: virtualizat...@lists.linux-foundation.org Cc: netdev@vger.kernel.org Signed-off-by: John Hubbard --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.c

[PATCH v2 0/2] vhost, docs: convert to pin_user_pages(), new "case 5"

2020-05-31 Thread John Hubbard
. [1] https://lore.kernel.org/r/20200527194953.11130-1-jhubb...@nvidia.com [2] https://lore.kernel.org/r/20200529070343.gl14...@quack2.suse.cz John Hubbard (2): docs: mm/gup: pin_user_pages.rst: add a "case 5" vhost: convert get_user_pages() --> pin_user_pages() Doc

[PATCH v2 1/2] docs: mm/gup: pin_user_pages.rst: add a "case 5"

2020-05-31 Thread John Hubbard
unpin" case. Add a fifth case, to help explain that there is a general pattern that requires pin_user_pages*() API calls. Cc: Vlastimil Babka Cc: Jan Kara Cc: Jérôme Glisse Cc: Dave Chinner Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Cc: linux-fsde...@vger.kernel.org Signed-of

Re: [PATCH 1/2] docs: mm/gup: pin_user_pages.rst: add a "case 5"

2020-05-31 Thread John Hubbard
ta within the pages +set_page_dirty_lock() +put_page() + I'll send a v2 shortly. thanks, -- John Hubbard NVIDIA

[PATCH 1/2] docs: mm/gup: pin_user_pages.rst: add a "case 5"

2020-05-29 Thread John Hubbard
unpin" case. Add a fifth case, to help explain that there is a general pattern that requires pin_user_pages*() API calls. Cc: Vlastimil Babka Cc: Jan Kara Cc: Jérôme Glisse Cc: Dave Chinner Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Cc: linux-fsde...@vger.kernel.org Signed-of

[PATCH 2/2] vhost: convert get_user_pages() --> pin_user_pages()

2020-05-29 Thread John Hubbard
07108/ Cc: Michael S. Tsirkin Cc: Jason Wang Cc: k...@vger.kernel.org Cc: virtualizat...@lists.linux-foundation.org Cc: netdev@vger.kernel.org Signed-off-by: John Hubbard --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.c

[PATCH 0/2] vhost, docs: convert to pin_user_pages(), new "case 5"

2020-05-29 Thread John Hubbard
does also include cross-compiling for a few other arches. Any run-time testing would be greatly appreciated. [1] https://lore.kernel.org/r/20200529070343.gl14...@quack2.suse.cz John Hubbard (2): docs: mm/gup: pin_user_pages.rst: add a "case 5" vhost: convert get_user_pages(

[bpf-next PATCH 2/3] bpf: fix running sk_skb program types with ktls

2020-05-29 Thread John Fastabend
erse order TCP -> TLS -> BPF. Discovered while testing OpenSSL 3.0 Alpha2.0 release. Fixes: d829e9c4112b5 ("tls: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- include/linux/skmsg.h |8 include/net/tls.h |9 ++

[bpf-next PATCH 3/3] bpf, selftests: add test for ktls with skb bpf ingress policy

2020-05-29 Thread John Fastabend
This adds a test for bpf ingress policy. To ensure data writes happen as expected with extra TLS headers we run these tests with data verification enabled by default. This will test receive packets have "PASS" stamped into the front of the payload. Signed-off-by: John

[bpf-next PATCH 1/3] bpf: refactor sockmap redirect code so its easy to reuse

2020-05-29 Thread John Fastabend
Signed-off-by: John Fastabend --- net/core/skmsg.c | 55 +- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index c479372..9d72f71 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -682,

[bpf-next PATCH 0/3] fix ktls with sk_skb_verdict programs

2020-05-29 Thread John Fastabend
verdict program. This analogous to how we handle a similar conflict on the TX side. Note, this is a fix but it doesn't make sense to push this late to bpf tree so targeting bpf-next and keeping fixes tags. --- John Fastabend (3): bpf: refactor sockmap redirect code so its easy to

RE: [PATCH] bpf/sockmap: fix kernel panic at __tcp_bpf_recvmsg

2020-05-26 Thread John Fastabend
ss_msg, > + struct sk_msg, list)) > +break; Thanks. Change looks good but spacing is a bit off . Can we turn those spaces into tabs? Otherwise adding fixes tag and my ack would be great. Fixes: 02c558b2d5d67 ("bpf: sockmap, support for msg_peek in sk_msg with redirect ingress") Acked-by: John Fastabend

Re: [bpf-next PATCH v5 1/5] bpf, sk_msg: add some generic helpers that may be useful from sk_msg

2020-05-26 Thread John Fastabend
Andrii Nakryiko wrote: > On Mon, May 25, 2020 at 3:57 PM John Fastabend > wrote: > > > > Daniel Borkmann wrote: > > > On 5/24/20 6:50 PM, John Fastabend wrote: > > > > Add these generic helpers that may be useful to use from sk_msg > > > > pr

Re: [bpf-next PATCH v5 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-25 Thread John Fastabend
Daniel Borkmann wrote: > On 5/24/20 6:50 PM, John Fastabend wrote: > > Often it is useful when applying policy to know something about the > > task. If the administrator has CAP_SYS_ADMIN rights then they can > > use kprobe + networking hook and link the two programs toget

Re: [bpf-next PATCH v5 1/5] bpf, sk_msg: add some generic helpers that may be useful from sk_msg

2020-05-25 Thread John Fastabend
Daniel Borkmann wrote: > On 5/24/20 6:50 PM, John Fastabend wrote: > > Add these generic helpers that may be useful to use from sk_msg programs. > > The helpers do not depend on ctx so we can simply add them here, > > > > BPF_FUNC_perf_event_output > &g

[bpf-next PATCH v5 5/5] bpf, selftests: test probe_* helpers from SCHED_CLS

2020-05-24 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Acked-by: Yonghong Song Signed-off-by: John

[bpf-next PATCH v5 4/5] bpf, selftests: add sk_msg helpers load and attach test

2020-05-24 Thread John Fastabend
-by: John Fastabend --- .../selftests/bpf/prog_tests/sockmap_basic.c | 35 +++ .../selftests/bpf/progs/test_skmsg_load_helpers.c | 47 2 files changed, 82 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c diff

[bpf-next PATCH v5 3/5] bpf, sk_msg: add get socket storage helpers

2020-05-24 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend Acked-by: Yonghong Song --- include/uapi/linux/bpf.h |2 ++ net/core/filter.c | 15 +++ tools/include/uapi/linux/bpf.h |2 ++ 3 files changed, 19 insertions(+) diff --git a/include

[bpf-next PATCH v5 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-24 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend Acked-by: Yonghong Song --- kernel/bpf/helpers.c | 24 kernel/tr

[bpf-next PATCH v5 1/5] bpf, sk_msg: add some generic helpers that may be useful from sk_msg

2020-05-24 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 822d662..a56046a 100644 --- a/net/core

[bpf-next PATCH v5 0/5] bpf: Add sk_msg and networking helpers

2020-05-24 Thread John Fastabend
check instead of CAP_SYS_ADMIN. Drop old probe helpers, probe_read() and probe_read_str() Added tests. Thanks to Daniel, Yonghong, and Andrii for review and feedback. --- John Fastabend (5): bpf, sk_msg: add some generic helpers that may be useful from sk_msg bpf: extend bpf_base_f

Re: [bpf-next PATCH v4 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-23 Thread John Fastabend
Daniel Borkmann wrote: > On 5/22/20 6:24 AM, John Fastabend wrote: > > Often it is useful when applying policy to know something about the > > task. If the administrator has CAP_SYS_ADMIN rights then they can > > use kprobe + networking hook and link the two programs toget

[bpf-next PATCH v4 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
-by: John Fastabend --- .../selftests/bpf/prog_tests/sockmap_basic.c | 35 +++ .../selftests/bpf/progs/test_skmsg_load_helpers.c | 47 2 files changed, 82 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c diff

[bpf-next PATCH v4 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-21 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Acked-by: Yonghong Song Signed-off-by: John

[bpf-next PATCH v4 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-21 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend Acked-by: Yonghong Song --- 0 files changed diff --git a/kernel/bpf/helpers.c b/kernel/

[bpf-next PATCH v4 3/5] bpf: sk_msg add get socket storage helpers

2020-05-21 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend Acked-by: Yonghong Song --- 0 files changed diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index b9b8a0f..d394b09 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -3641,6 +3641,8

[bpf-next PATCH v4 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-21 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- 0 files changed diff --git a/net/core/filter.c b/net/core/filter.c index 822d662..a56046a 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6443,6 +6443,22

[bpf-next PATCH v4 0/5] bpf: Add sk_msg and networking helpers

2020-05-21 Thread John Fastabend
nstead of CAP_SYS_ADMIN. Drop old probe helpers, probe_read() and probe_read_str() Added tests. Thanks to Daniel, Yonghong, and Andrii for review and feedback. --- John Fastabend (5): bpf: sk_msg add some generic helpers that may be useful from sk_msg bpf: extend bpf_base_func_prot

Re: [PATCH v2] netprio_cgroup: Fix unlimited memory leak of v2 cgroups

2020-05-21 Thread John Fastabend
would fix the issue above and also keep the original behavior. And then while reviewing I also wonder do we have the same issue described here in netclasid_cgroup.c with the cgrp_attach()? It would be best to keep netcls and netprio in sync in this regard imo. At least netcls calls cgroup_sk_alloc_disable in the write_classid() hook so I suspect it makes sense to also add that to the attach hook? Thanks, John

[bpf-next PATCH v2 4/4] bpf: selftests, add printk to test_sk_lookup_kern to encode null ptr check

2020-05-21 Thread John Fastabend
r one. Acked-by: Andrii Nakryiko Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sk_lookup_kern.c |1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c index d2

[bpf-next PATCH v2 3/4] bpf: selftests, verifier case for non null pointer map value branch

2020-05-21 Thread John Fastabend
When we have pointer type that is known to be non-null we only follow the non-null branch. This adds tests to cover the map_value pointer returned from a map lookup. To force an error if both branches are followed we do an ALU op on R10. Acked-by: Andrii Nakryiko Signed-off-by: John Fastabend

[bpf-next PATCH v2 2/4] bpf: selftests, verifier case for non null pointer check branch taken

2020-05-21 Thread John Fastabend
. Signed-off-by: John Fastabend --- .../testing/selftests/bpf/verifier/ref_tracking.c | 33 1 file changed, 33 insertions(+) diff --git a/tools/testing/selftests/bpf/verifier/ref_tracking.c b/tools/testing/selftests/bpf/verifier/ref_tracking.c index 604b461..056e027 100644

[bpf-next PATCH v2 0/4] ] verifier, improve ptr is_branch_taken logic

2020-05-21 Thread John Fastabend
messages hopefully its better now. --- John Fastabend (4): bpf: verifier track null pointer branch_taken with JNE and JEQ bpf: selftests, verifier case for non null pointer check branch taken bpf: selftests, verifier case for non null pointer map value branch bpf: s

[bpf-next PATCH v2 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-21 Thread John Fastabend
ve passes as expected. Suggested-by: Alexei Starovoitov Reported-by: Andrey Ignatov Signed-off-by: John Fastabend --- kernel/bpf/verifier.c | 36 +--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c

Re: [bpf-next PATCH v3 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-21 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, May 21, 2020 at 7:36 AM John Fastabend > wrote: > > > > Lets test using probe* in SCHED_CLS network programs as well just > > to be sure these keep working. Its cheap to add the extra test > > and provides a second context to test

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
John Fastabend wrote: > Andrii Nakryiko wrote: > > On Thu, May 21, 2020 at 7:36 AM John Fastabend > > wrote: > > > > > > The test itself is not particularly useful but it encodes a common > > > pattern we have. > > > > > > Namely

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
Andrii Nakryiko wrote: > On Thu, May 21, 2020 at 7:36 AM John Fastabend > wrote: > > > > The test itself is not particularly useful but it encodes a common > > pattern we have. > > > > Namely do a sk storage lookup then depending on data here deci

Re: [bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
Yonghong Song wrote: > > > On 5/21/20 7:35 AM, John Fastabend wrote: > > The test itself is not particularly useful but it encodes a common > > pattern we have. > > > > Namely do a sk storage lookup then depending on data here decide if > > we need to do

[bpf-next PATCH v3 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-21 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Signed-off-by: John Fastabend --- .../testing

[bpf-next PATCH v3 4/5] bpf: selftests, add sk_msg helpers load and attach test

2020-05-21 Thread John Fastabend
-by: John Fastabend --- .../selftests/bpf/prog_tests/sockmap_basic.c | 57 .../selftests/bpf/progs/test_skmsg_load_helpers.c | 48 + 2 files changed, 105 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c

[bpf-next PATCH v3 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-21 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend Acked-by: Yonghong Song --- kernel/bpf/helpers.c | 27 +++ ker

[bpf-next PATCH v3 3/5] bpf: sk_msg add get socket storage helpers

2020-05-21 Thread John Fastabend
Add helpers to use local socket storage. Signed-off-by: John Fastabend Acked-by: Yonghong Song --- include/uapi/linux/bpf.h |2 ++ net/core/filter.c | 15 +++ tools/include/uapi/linux/bpf.h |2 ++ 3 files changed, 19 insertions(+) diff --git a/include

[bpf-next PATCH v3 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-21 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 822d662..a56046a 100644 --- a/net/core

[bpf-next PATCH v3 0/5] bpf: Add sk_msg and networking helpers

2020-05-21 Thread John Fastabend
now in bpf-next so use perfmon_capable() check instead of CAP_SYS_ADMIN. Drop old probe helpers, probe_read() and probe_read_str() Added tests. Thanks to Daniel and Yonghong for review and feedback. --- John Fastabend (5): bpf: sk_msg add some generic helpers that may be useful from

[PATCH] rds: fix crash in rds_info_getsockopt()

2020-05-20 Thread John Hubbard
;) Cc: David S. Miller Cc: Jakub Kicinski Cc: netdev@vger.kernel.org Cc: linux-r...@vger.kernel.org Cc: rds-de...@oss.oracle.com Signed-off-by: John Hubbard --- net/rds/info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/rds/info.c b/net/rds/info.c index

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-18 Thread John Fastabend
David Ahern wrote: > On 5/18/20 12:10 PM, John Fastabend wrote: > >> > >> host ingress to VM is one use case; VM to VM on the same host is another. > > > > But host ingress to VM would still work with tail calls because the XDP > > packet came from anot

Re: [bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
Andrii Nakryiko wrote: > On Mon, May 18, 2020 at 1:05 PM John Fastabend > wrote: > > > > Current verifier when considering which branch may be taken on a > > conditional test with pointer returns -1 meaning either branch may > > be taken. But, we track if pointers

RE: [bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
John Fastabend wrote: > Current verifier when considering which branch may be taken on a > conditional test with pointer returns -1 meaning either branch may > be taken. But, we track if pointers can be NULL by using dedicated > types for valid pointers (pointers that can not be NULL).

[bpf-next PATCH 3/4] bpf: selftests, verifier case for non null pointer map value branch

2020-05-18 Thread John Fastabend
When we have pointer type that is known to be non-null we only follow the non-null branch. This adds tests to cover the map_value pointer returned from a map lookup. To force an error if both branches are followed we do an ALU op on R10. Signed-off-by: John Fastabend --- .../testing/selftests

[bpf-next PATCH 4/4] bpf: selftests, add printk to test_sk_lookup_kern to encode null ptr check

2020-05-18 Thread John Fastabend
r one. Signed-off-by: John Fastabend --- .../selftests/bpf/progs/test_sk_lookup_kern.c |1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c index d2b38fa..e83d0b4 100644 --- a/

[bpf-next PATCH 0/4] verifier, improve ptr is_branch_taken logic

2020-05-18 Thread John Fastabend
much in the way of test overhead. --- John Fastabend (4): bpf: verifier track null pointer branch_taken with JNE and JEQ bpf: selftests, verifier case for non null pointer check branch taken bpf: selftests, verifier case for non null pointer map value branch bpf: selftests

[bpf-next PATCH 1/4] bpf: verifier track null pointer branch_taken with JNE and JEQ

2020-05-18 Thread John Fastabend
0x0'. After the above additional logic is added the C code above passes as expected. This makes the assumption that all pointer types PTR_TO_* that can be null have an equivalent type PTR_TO_*_OR_NULL logic. Suggested-by: Alexei Starovoitov Reported-by: Andrey Ignatov Signed-off-by: John F

[bpf-next PATCH 2/4] bpf: selftests, verifier case for non null pointer check branch taken

2020-05-18 Thread John Fastabend
When we have pointer type that is known to be non-null we only follow the non-null branch. This adds tests to cover this case for reference tracking. Signed-off-by: John Fastabend --- .../testing/selftests/bpf/verifier/ref_tracking.c | 16 1 file changed, 16 insertions

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-18 Thread John Fastabend
David Ahern wrote: > On 5/15/20 4:54 PM, John Fastabend wrote: > > Hi David, > > > > Another way to set up egress programs that I had been thinking about is to > > build a prog_array map with a slot per interface then after doing the > > redirect (or I guess

[PATCH] rds: convert get_user_pages() --> pin_user_pages()

2020-05-16 Thread John Hubbard
Miller Cc: Jakub Kicinski Cc: netdev@vger.kernel.org Cc: linux-r...@vger.kernel.org Cc: rds-de...@oss.oracle.com Signed-off-by: John Hubbard --- net/rds/info.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/rds/info.c b/net/rds/info.c index 03f6fd56d237..e1d63563e8

Re: [PATCH v5 bpf-next 00/11] net: Add support for XDP in egress path

2020-05-15 Thread John Fastabend
awhile on my todo list so could add that for other use cases as well if that was the only problem. Sorry for the late reply it took me a bit of time to mull over the patches. Thanks, John

[bpf-next PATCH v2 5/5] bpf: selftests, test probe_* helpers from SCHED_CLS

2020-05-15 Thread John Fastabend
Lets test using probe* in SCHED_CLS network programs as well just to be sure these keep working. Its cheap to add the extra test and provides a second context to test outside of sk_msg after we generalized probe* helpers to all networking types. Signed-off-by: John Fastabend --- .../testing

[bpf-next PATCH v2 1/5] bpf: sk_msg add some generic helpers that may be useful from sk_msg

2020-05-15 Thread John Fastabend
BPF_FUNC_get_current_ancestor_cgroup_id BPF_FUNC_get_cgroup_classid Acked-by: Yonghong Song Signed-off-by: John Fastabend --- net/core/filter.c | 16 1 file changed, 16 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index f8a3c7e..7dac2b6 100644 --- a/net/core

[bpf-next PATCH v2 2/5] bpf: extend bpf_base_func_proto helpers with probe_* and *current_task*

2020-05-15 Thread John Fastabend
ing, BPF_FUNC_get_current_task BPF_FUNC_current_task_under_cgroup BPF_FUNC_probe_read_user BPF_FUNC_probe_read_kernel BPF_FUNC_probe_read_user_str BPF_FUNC_probe_read_kernel_str Signed-off-by: John Fastabend --- kernel/bpf/helpers.c | 27 +++ kernel/trace/bpf_trace.c |

<    1   2   3   4   5   6   7   8   9   10   >