Re: [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls

2019-10-02 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > John Fastabend writes: > > > Toke Høiland-Jørgensen wrote: > >> Alan Maguire writes: > >> > >> > On Wed, 2 Oct 2019, Toke Høiland-Jørgensen wrote: > >> > > >> >> This series adds support

RE: [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls

2019-10-02 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > This series adds support for executing multiple XDP programs on a single > interface in sequence, through the use of chain calls, as discussed at the > Linux > Plumbers Conference last month: > > https://linuxplumbersconf.org/event/4/contributions/460/ > > # HIGH-

Re: [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls

2019-10-02 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > Alan Maguire writes: > > > On Wed, 2 Oct 2019, Toke Høiland-Jørgensen wrote: > > > >> This series adds support for executing multiple XDP programs on a single > >> interface in sequence, through the use of chain calls, as discussed at the > >> Linux > >> Plumbers

Re: [PATCH bpf-next 2/6] libbpf: move bpf_helpers.h, bpf_endian.h into libbpf

2019-10-01 Thread John Fastabend
Andrii Nakryiko wrote: > On Tue, Oct 1, 2019 at 12:18 PM John Fastabend > wrote: > > > > Toke Høiland-Jørgensen wrote: > > > > > > > +struct bpf_map_def { > > > > + unsigned int type; > > > > + unsigned int key_size; > >

RE: [PATCH bpf-next 6/6] selftests/bpf: add BPF_CORE_READ and BPF_CORE_READ_STR_INTO macro tests

2019-10-01 Thread John Fastabend
Andrii Nakryiko wrote: > Validate BPF_CORE_READ correctness and handling of up to 9 levels of > nestedness using cyclic task->(group_leader->)*->tgid chains. > > Also add a test of maximum-dpeth BPF_CORE_READ_STR_INTO() macro. > > Signed-off-by: Andrii Nakryiko > --- Acked-by: John Fastabend

Re: [PATCH bpf-next 2/6] libbpf: move bpf_helpers.h, bpf_endian.h into libbpf

2019-10-01 Thread John Fastabend
Toke Høiland-Jørgensen wrote: > > > +struct bpf_map_def { > > + unsigned int type; > > + unsigned int key_size; > > + unsigned int value_size; > > + unsigned int max_entries; > > + unsigned int map_flags; > > + unsigned int inner_map_idx; > > + unsigned int numa_node; > > +}; > > Di

RE: [PATCH bpf-next 5/6] selftests/bpf: adjust CO-RE reloc tests for new BPF_CORE_READ macro

2019-10-01 Thread John Fastabend
nesting.c| 6 -- > .../bpf/progs/test_core_reloc_primitives.c | 12 +++- > .../bpf/progs/test_core_reloc_ptr_as_arr.c | 4 +++- > 9 files changed, 54 insertions(+), 36 deletions(-) > Starting to get many layers of macros here but makes sense here. Acked-by: John Fastabend

RE: [PATCH bpf-next 1/6] selftests/bpf: undo GCC-specific bpf_helpers.h changes

2019-10-01 Thread John Fastabend
\ > type_key key; \ > -- > 2.17.1 > Acked-by: John Fastabend

RE: [PATCH bpf-next 4/6] libbpf: add BPF_CORE_READ/BPF_CORE_READ_INTO helpers

2019-10-01 Thread John Fastabend
Andrii Nakryiko wrote: > Add few macros simplifying BCC-like multi-level probe reads, while also > emitting CO-RE relocations for each read. > > Signed-off-by: Andrii Nakryiko LGTM. Acked-by: John Fastabend

Re: [PATCH V11 0/4] BPF: New helper to obtain namespace data from current task

2019-09-26 Thread John Fastabend
Eric W. Biederman wrote: > Carlos Neira writes: > > > Currently bpf_get_current_pid_tgid(), is used to do pid filtering in bcc's > > scripts but this helper returns the pid as seen by the root namespace which > > is > > fine when a bcc script is not executed inside a container. > > When the proc

RE: [PATCH net] net: sched: fix reordering issues

2019-09-05 Thread John Fastabend
e to block the dequeue process as long > as the first packet in bad_txq can not be sent. Reordering issues > disappear and no side effects have been seen. > > Fixes: a53851e2c321 ("net: sched: explicit locking in gso_cpu fallback") > Signed-off-by: Eric Dumazet > Cc: John F

Re: [PATCH net-next 0/5] net/tls: minor cleanups

2019-09-03 Thread John Fastabend
s/tls_device.c | 78 +++ > > net/tls/tls_main.c| 46 - > > net/tls/tls_sw.c | 6 +- > > 5 files changed, 85 insertions(+), 99 deletions(-) > > LGTM > > Reviewed-by: Boris Pismenny > Also LGTM. primarily reviewed the tls_{main|sw}.c pieces Reviewed-by: John Fastabend

RE: [PATCH net-next 4/5] net/tls: clean up the number of #ifdefs for CONFIG_TLS_DEVICE

2019-09-03 Thread John Fastabend
+ > 3 files changed, 35 insertions(+), 28 deletions(-) Thanks I've been meaning to do this I agree it looks nicer. Acked-by: John Fastabend

RE: [PATCH net-next 1/5] net/tls: use the full sk_proto pointer

2019-09-03 Thread John Fastabend
t; --- > drivers/crypto/chelsio/chtls/chtls_main.c | 6 +++-- > include/net/tls.h | 10 - > net/tls/tls_main.c| 27 +-- > 3 files changed, 14 insertions(+), 29 deletions(-) > I like it should probably do

[net PATCH] net: sock_map, fix missing ulp check in sock hash case

2019-09-03 Thread John Fastabend
t;bpf, sockmap: convert to generic sk_msg interface") Reported-by: syzbot+7a6ee4d0078eac6bf...@syzkaller.appspotmail.com Signed-off-by: John Fastabend --- net/core/sock_map.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 1330a7

[net PATCH] net: route dump netlink NLM_F_MULTI flag missing

2019-08-23 Thread John Fastabend
e exceptions if requested") Signed-off-by: John Fastabend --- include/net/route.h |2 +- net/ipv4/fib_trie.c |2 +- net/ipv4/route.c| 17 ++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/net/route.h b/include/net/route.h index 630a0493f1f3.

Re: various TLS bug fixes...

2019-08-20 Thread John Fastabend
sing fixes. > > Is it okay if I come back to this tomorrow? Is the failure with hw offload or sw case? If its sendpage related looks like we also need to push the following patch back to 4.19, commit 648ee6cea7dde4a5cdf817e5d964fd60b22006a4 Author: John Fastabend Date: Wed Jun 12 17:23:57 2019 + net: tls, correctly account for copied bytes with multiple sk_msgs If you have more details I can also spend some cycles looking into it. .John

[net PATCH] net: tls, fix sk_write_space NULL write when tx disabled

2019-08-13 Thread John Fastabend
nction indicating the tls module should clean it up properly as well. Reported-by: Hillf Danton Cc: Ying Xue Cc: Andrey Konovalov Fixes: 57c722e932cfb ("net/tls: swap sk_write_space on close") Signed-off-by: John Fastabend --- net/tls/tls_main.c |3 ++- 1 file changed, 2 insertion

Re: [PATCH net 1/2] net/tls: partially revert fix transition through disconnect with close

2019-08-05 Thread John Fastabend
went back and ran some of the syzbot tests that were failing before original series and most of my ktls+bpf tests and everything seems in good shape now. There is still one issue with crypto stack that I'll look at fixing now. Thanks. Acked-by: John Fastabend Tested-by: John Fastabend

Re: BPF: ETLS: RECV FLOW

2019-08-04 Thread John Fastabend
Shridhar Venkatraman wrote: > Hi, > > The eTLS work has BPF integration which is great. > However there is one spot where access to the clear text is not available. Guessing eTLS is a typo for KTLS. > > From kernel 4.20 - receiver BPF support added for KTLS. > > a. receiver BPF is applied on e

RE: [PATCH net 1/2] net/tls: partially revert fix transition through disconnect with close

2019-08-02 Thread John Fastabend
Jakub Kicinski wrote: > Looks like we were slightly overzealous with the shutdown() > cleanup. Even though the sock->sk_state can reach CLOSED again, > socket->state will not got back to SS_UNCONNECTED once > connections is ESTABLISHED. Meaning we will see EISCONN if > we try to reconnect, and EINV

Re: [PATCH bpf v4 00/14] sockmap/tls fixes

2019-07-22 Thread John Fastabend
t. > > > > Sorry for the delay, this code is quite tricky. According to my testing > > TLS SW and HW should now work, I hope I didn't regress things on the > > sockmap side. > > Applied, thanks everyone! Thanks Jakub, for the patches without my signed-off already Acked-by: John Fastabend

Re: [PATCH bpf v4 00/14] sockmap/tls fixes

2019-07-22 Thread John Fastabend
Jakub Kicinski wrote: > On Fri, 19 Jul 2019 10:29:13 -0700, Jakub Kicinski wrote: > > John says: > > > > Resolve a series of splats discovered by syzbot and an unhash > > TLS issue noted by Eric Dumazet. > > Sorry for the delay, this code is quite tricky. According to my testing > TLS SW and HW s

Re: [bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-15 Thread John Fastabend
Jakub Kicinski wrote: > On Thu, 11 Jul 2019 14:25:54 -0700, John Fastabend wrote: > > Jakub Kicinski wrote: > > > On Thu, 11 Jul 2019 09:47:16 -0700, John Fastabend wrote: > > > > Jakub Kicinski wrote: > > > > > On Wed, 10

[bpf PATCH v3 8/8] bpf: sockmap/tls, close can race with map free

2019-07-15 Thread John Fastabend
t;bpf: sockmap, support for msg_peek in sk_msg with redirect ingress") Signed-off-by: John Fastabend --- include/linux/skmsg.h |8 +++- include/net/tcp.h |3 +++ net/core/skmsg.c |4 ++-- net/ipv4/tcp_ulp.c| 13 + net/tls/tls_main.c

[bpf PATCH v3 2/8] tls: remove close callback sock unlock/lock around TX work flush

2019-07-15 Thread John Fastabend
use SCHEDULE bit is set now no new work will be scheduled. Tested with net selftests and bpf selftests. Signed-off-by: John Fastabend Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe --- include/net/tls.h |2 ++ net/tls/tls_main.c |3 +++ net/tls/tls_sw.c |

[bpf PATCH v3 6/8] bpf: sockmap, synchronize_rcu before free'ing map

2019-07-15 Thread John Fastabend
We need to have a synchronize_rcu before free'ing the sockmap because any outstanding psock references will have a pointer to the map and when they use this could trigger a use after free. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by:

[bpf PATCH v3 7/8] bpf: sockmap, only create entry if ulp is not already enabled

2019-07-15 Thread John Fastabend
case but fixup the bug here. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/sock_map.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 56bcabe7c2f2..1330a7442

[bpf PATCH v3 1/8] net/tls: don't arm strparser immediately in tls_set_sw_offload()

2019-07-15 Thread John Fastabend
From: Jakub Kicinski In tls_set_device_offload_rx() we prepare the software context for RX fallback and proceed to add the connection to the device. Unfortunately, software context prep includes arming strparser so in case of a later error we have to release the socket lock to call strp_done().

[bpf PATCH v3 4/8] bpf: tls fix transition through disconnect with close

2019-07-15 Thread John Fastabend
xes: 3c4d7559159bf ("tls: kernel TLS support") Reported-by: Eric Dumazet Signed-off-by: John Fastabend --- include/net/tls.h |5 - net/tls/tls_main.c | 57 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/include/net/tl

[bpf PATCH v3 3/8] tls: remove sock unlock/lock around strp_done()

2019-07-15 Thread John Fastabend
we don't arm the strparser until we are sure init will be successful. Signed-off-by: John Fastabend Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe --- include/net/tls.h|4 ++- net/tls/tls_device.c |1 - net/tls/tls_main.c |

[bpf PATCH v3 0/8] sockmap/tls fixes

2019-07-15 Thread John Fastabend
kub Kicinski (1): net/tls: don't arm strparser immediately in tls_set_sw_offload() John Fastabend (7): tls: remove close callback sock unlock/lock around TX work flush tls: remove sock unlock/lock around strp_done() bpf: tls fix transition through disconnect with close

[bpf PATCH v3 5/8] bpf: sockmap, sock_map_delete needs to use xchg

2019-07-15 Thread John Fastabend
ap entry which can result in both paths trying to free the map entry. To fix use xchg in TCP paths as well so we avoid having two references to the same map entry. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core

Re: [bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-11 Thread John Fastabend
Jakub Kicinski wrote: > On Thu, 11 Jul 2019 09:47:16 -0700, John Fastabend wrote: > > Jakub Kicinski wrote: > > > On Wed, 10 Jul 2019 12:34:17 -0700, Jakub Kicinski wrote: > > > > > > > + if (sk->sk_prot->unhash) > >

Re: [bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-11 Thread John Fastabend
Jakub Kicinski wrote: > On Wed, 10 Jul 2019 12:34:17 -0700, Jakub Kicinski wrote: > > > > > + if (sk->sk_prot->unhash) > > > > > + sk->sk_prot->unhash(sk); > > > > > + } > > > > > + > > > > > + ctx = tls_get_ctx(sk); > > > > > + if (ctx->tx_conf == TLS_SW

Re: [bpf PATCH v2 6/6] bpf: sockmap/tls, close can race with map free

2019-07-11 Thread John Fastabend
Jakub Kicinski wrote: > On Tue, 09 Jul 2019 20:33:58 -0700, John Fastabend wrote: > > Jakub Kicinski wrote: > > > On Mon, 08 Jul 2019 19:15:18 +0000, John Fastabend wrote: > > > > @@ -352,15 +354,18 @@ static void tls_sk_proto_close(struct sock *sk, > > >

Re: [bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-11 Thread John Fastabend
Jakub Kicinski wrote: > On Tue, 09 Jul 2019 20:39:24 -0700, John Fastabend wrote: > > Jakub Kicinski wrote: > > > On Mon, 08 Jul 2019 19:14:05 +0000, John Fastabend wrote: > > > > @@ -287,6 +313,27 @@ static void tls_sk_proto_cleanup(st

Re: [bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-09 Thread John Fastabend
Jakub Kicinski wrote: > On Mon, 08 Jul 2019 19:14:05 +0000, John Fastabend wrote: > > @@ -287,6 +313,27 @@ static void tls_sk_proto_cleanup(struct sock *sk, > > #endif > > } > > > > +static void tls_sk_proto_unhash(struct sock *sk) > > +{ > > + st

Re: [bpf PATCH v2 6/6] bpf: sockmap/tls, close can race with map free

2019-07-09 Thread John Fastabend
Jakub Kicinski wrote: > On Mon, 08 Jul 2019 19:15:18 +0000, John Fastabend wrote: > > @@ -352,15 +354,18 @@ static void tls_sk_proto_close(struct sock *sk, long > > timeout) > > if (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE) > >

Re: [bpf PATCH v2 0/6] bpf: sockmap/tls fixes

2019-07-09 Thread John Fastabend
Jakub Kicinski wrote: > On Tue, 9 Jul 2019 17:04:59 -0700, Jakub Kicinski wrote: > > On Tue, 09 Jul 2019 08:40:14 -0700, John Fastabend wrote: > > > Jakub Kicinski wrote: > > > > Looks like strparser is not done'd for offload? > > > > >

Re: [bpf PATCH v2 0/6] bpf: sockmap/tls fixes

2019-07-09 Thread John Fastabend
Jakub Kicinski wrote: > On Mon, 08 Jul 2019 19:13:29 +0000, John Fastabend wrote: > > Resolve a series of splats discovered by syzbot and an unhash > > TLS issue noted by Eric Dumazet. > > > > The main issues revolved around interaction between TLS and > > sockmap

[bpf PATCH v2 6/6] bpf: sockmap/tls, close can race with map free

2019-07-08 Thread John Fastabend
t;bpf: sockmap, support for msg_peek in sk_msg with redirect ingress") Signed-off-by: John Fastabend --- include/linux/skmsg.h |8 +++- include/net/tcp.h |3 +++ net/core/skmsg.c |4 ++-- net/ipv4/tcp_ulp.c| 13 + net/tls/tls_main.c

[bpf PATCH v2 5/6] bpf: sockmap, only create entry if ulp is not already enabled

2019-07-08 Thread John Fastabend
case but fixup the bug here. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/sock_map.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/sock_map.c b/net/core/sock_map.c index 56bcabe7c2f2..1330a7442

[bpf PATCH v2 4/6] bpf: sockmap, synchronize_rcu before free'ing map

2019-07-08 Thread John Fastabend
We need to have a synchronize_rcu before free'ing the sockmap because any outstanding psock references will have a pointer to the map and when they use this could trigger a use after free. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by:

[bpf PATCH v2 3/6] bpf: sockmap, sock_map_delete needs to use xchg

2019-07-08 Thread John Fastabend
ap entry which can result in both paths trying to free the map entry. To fix use xchg in TCP paths as well so we avoid having two references to the same map entry. Fixes: 604326b41a6fb ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core

[bpf PATCH v2 1/6] tls: remove close callback sock unlock/lock and flush_sync

2019-07-08 Thread John Fastabend
een when we set SCHEDULE bit and cancel work. Then because SCHEDULE bit is set now no new work will be scheduled. Then strp_done() is called after the sk work is completed. Any outstanding work is sync'd and finally ctx is free'd. Tested with net selftests and bpf selftests. Signed

[bpf PATCH v2 2/6] bpf: tls fix transition through disconnect with close

2019-07-08 Thread John Fastabend
xes: 3c4d7559159bf ("tls: kernel TLS support") Reported-by: Eric Dumazet Signed-off-by: John Fastabend --- include/net/tls.h |6 +- net/tls/tls_main.c | 54 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/include/net/tl

[bpf PATCH v2 0/6] bpf: sockmap/tls fixes

2019-07-08 Thread John Fastabend
map. Then apply three fixes to sockmap to fix up races on tear down around map free and close. Finally, if sockmap is destroyed before TLS we add a new ULP op update to inform the TLS stack it should not call sockmap ops. This last one appears to be the most commonly found issue from syzbot. --- J

Re: kernel panic: corrupted stack end in dput

2019-07-03 Thread John Fastabend
Eric Biggers wrote: > [+bpf and tls maintainers] > > On Wed, Jul 03, 2019 at 04:23:34PM +0100, Al Viro wrote: > > On Wed, Jul 03, 2019 at 03:40:00PM +0100, Al Viro wrote: > > > On Wed, Jul 03, 2019 at 02:43:07PM +0800, Hillf Danton wrote: > > > > > > > > This is very much *NOT* fine. > > > > >

Re: [PATCH 1/2] tls: remove close callback sock unlock/lock and flush_sync

2019-06-28 Thread John Fastabend
Jakub Kicinski wrote: > On Fri, 28 Jun 2019 12:40:29 -0700, John Fastabend wrote: > > The lock() is already held when entering unhash() side so need to > > handle this case as well, > > > > CPU 0 (free) CPU 1 (wq) > > > > lock(sk) ct

Re: [PATCH 1/2] tls: remove close callback sock unlock/lock and flush_sync

2019-06-28 Thread John Fastabend
Jakub Kicinski wrote: > On Fri, 28 Jun 2019 07:12:07 -0700, John Fastabend wrote: > > Yeah seems possible although never seen in my testing. So I'll > > move the test_bit() inside the lock and do a ctx check to ensure > > still have the reference. > > > &

Re: [PATCH 1/2] tls: remove close callback sock unlock/lock and flush_sync

2019-06-28 Thread John Fastabend
Jakub Kicinski wrote: > On Thu, 27 Jun 2019 10:36:42 -0700, John Fastabend wrote: > > The tls close() callback currently drops the sock lock, makes a > > cancel_delayed_work_sync() call, and then relocks the sock. This > > seems suspect at best. The lock_sock() is appli

RE: [PATCH 0/2] tls, add unhash callback

2019-06-27 Thread John Fastabend
John Fastabend wrote: > Resolve a series of splats discovered by syzbot and noted by > Eric Dumazet. The primary problem here is we resolved an issue on > the BPF sockmap side by adding an unhash callback. This is > required to ensure sockmap sockets do not transition out of > ES

[PATCH 2/2] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-06-27 Thread John Fastabend
3a443366d8...@syzkaller.appspotmail.com Reported-by: syzbot+06537213db7ba2745...@syzkaller.appspotmail.com Signed-off-by: John Fastabend --- include/net/tls.h |2 ++ net/tls/tls_main.c | 50 +++--- 2 files changed, 45 insertions(+), 7 deletions(-) di

[PATCH 0/2] tls, add unhash callback

2019-06-27 Thread John Fastabend
LISTEN state. This transition is a similar bug to the one found and fixed previously in sockmap. And cleans up the callbacks to fix the syzbot errors. --- John Fastabend (2): tls: remove close callback sock unlock/lock and flush_sync bpf: tls, implement unhash to avoid transition out

[PATCH 1/2] tls: remove close callback sock unlock/lock and flush_sync

2019-06-27 Thread John Fastabend
build_protos, prot[TLS_SW][TLS_BASE] prot[TLS_BASE][TLS_SW] prot[TLS_SW][TLS_SW] The implication is a follow up patch is needed to resolve the hardware offload case. Tested with net selftests and bpf selftests. Signed-off-by: John Fastabend --- include/net/tls.h |4 ++-- net/tls

RE: [PATCH v3 bpf-next 3/9] bpf: extend is_branch_taken to registers

2019-06-19 Thread John Fastabend
en when program executes. > That speeds up the verification and is essential feature to support > bounded loops. > > Signed-off-by: Alexei Starovoitov > Acked-by: Andrii Nakryiko > --- Acked-by: John Fastabend

RE: [PATCH v3 bpf-next 2/9] selftests/bpf: fix tests due to const spill/fill

2019-06-19 Thread John Fastabend
/helper_access_var_len.c | 28 ++- > 2 files changed, 17 insertions(+), 14 deletions(-) > Acked-by: John Fastabend

Re: [PATCH v3 bpf-next 1/9] bpf: track spill/fill of constants

2019-06-19 Thread John Fastabend
Alexei Starovoitov wrote: > On Wed, Jun 19, 2019 at 05:24:32PM -0700, John Fastabend wrote: > > Alexei Starovoitov wrote: > > > Compilers often spill induction variables into the stack, > > > hence it is necessary for the verifier to track scalar values > > >

RE: [PATCH v3 bpf-next 1/9] bpf: track spill/fill of constants

2019-06-19 Thread John Fastabend
Alexei Starovoitov wrote: > Compilers often spill induction variables into the stack, > hence it is necessary for the verifier to track scalar values > of the registers through stack slots. > > Also few bpf programs were incorrectly rejected in the past, > since the verifier was not able to track

[net PATCH v2] net: tls, correctly account for copied bytes with multiple sk_msgs

2019-06-12 Thread John Fastabend
t for this to bpf-next shortly. The fix is to _not_ zero the copied field so that the total sent bytes is returned. Reported-by: Steinar H. Gunderson Reported-by: Andre Tomt Tested-by: Andre Tomt Fixes: d829e9c4112b ("tls: convert to generic sk_msg interface") Signed-off-by: John Fastaben

[net PATCH] net: tls, correctly account for copied bytes with multiple sk_msgs

2019-06-10 Thread John Fastabend
ric sk_msg interface") Signed-off-by: John Fastabend --- net/tls/tls_sw.c |1 - 1 file changed, 1 deletion(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index d93f83f77864..5fe3dfa2c5e3 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1143,7 +1143,6 @@ static int tls_sw_do_

Re: [PATCH] bpf: sockmap, fix use after free from sleep in psock backlog workqueue

2019-05-24 Thread John Fastabend
Daniel Borkmann wrote: > On 05/23/2019 05:48 PM, John Fastabend wrote: > > Backlog work for psock (sk_psock_backlog) might sleep while waiting > > for memory to free up when sending packets. However, while sleeping > > the socket may be closed and removed from the map by th

Re: [PATCH net] sk_msg: Keep reference on socket file while psock lives

2019-05-24 Thread John Fastabend
Jakub Sitnicki wrote: > On Thu, May 23, 2019 at 05:58 PM CEST, John Fastabend wrote: > > [...] > > > >> > >> Thanks for taking a look at it. Setting MSG_DONTWAIT works great for > >> me. No more crashes in sk_stream_wait_memory. I've tested it on top

[PATCH v2] bpf: sockmap, fix use after free from sleep in psock backlog workqueue

2019-05-24 Thread John Fastabend
: 20bf50de3028c ("skbuff: Function to send an skbuf on a socket") Reported-by: Jakub Sitnicki Tested-by: Jakub Sitnicki Signed-off-by: John Fastabend --- net/core/skbuff.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index e89be62..4a7c656 10

Re: [PATCH net] sk_msg: Keep reference on socket file while psock lives

2019-05-23 Thread John Fastabend
[...] > > Thanks for taking a look at it. Setting MSG_DONTWAIT works great for > me. No more crashes in sk_stream_wait_memory. I've tested it on top of > current bpf-next (f49aa1de9836). Here's my: > > Tested-by: Jakub Sitnicki > > The actual I've tested is below, for completeness. > > BTW.

[PATCH] bpf: sockmap, fix use after free from sleep in psock backlog workqueue

2019-05-23 Thread John Fastabend
: 20bf50de3028c ("skbuff: Function to send an skbuf on a socket") Reported-by: Jakub Sitnicki Tested-by: Jakub Sitnicki Signed-off-by: John Fastabend --- net/core/skbuff.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index e89be62..c3b03c5 10

Re: [bpf PATCH v4 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-05-22 Thread John Fastabend
Jakub Kicinski wrote: > On Thu, 09 May 2019 21:57:49 -0700, John Fastabend wrote: [...] > > Looks like David Beckett managed to trigger another nasty on the > release path :/ > > BUG: kernel NULL pointer dereference, address: 0012 > PGD 0 P4D 0 >

Re: [PATCH net] sk_msg: Keep reference on socket file while psock lives

2019-05-21 Thread John Fastabend
Jakub Sitnicki wrote: > Hi Daniel, > > On Tue, Feb 19, 2019 at 05:00 PM CET, Daniel Borkmann wrote: > > On 02/11/2019 10:09 AM, Jakub Sitnicki wrote: > >> Backlog work for psock (sk_psock_backlog) might sleep while waiting for > >> memory to free up when sending packets. While sleeping, socket can

Re: [bpf PATCH v4 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-05-14 Thread John Fastabend
Jakub Kicinski wrote: > On Tue, 14 May 2019 15:34:55 -0700, John Fastabend wrote: > > John Fastabend wrote: > > > Jakub Kicinski wrote: > > > > On Thu, 09 May 2019 21:57:49 -0700, John Fastabend wrote: > > > > > @@ -2042,12 +2060,14 @@

Re: [bpf PATCH v4 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-05-14 Thread John Fastabend
John Fastabend wrote: > Jakub Kicinski wrote: > > On Thu, 09 May 2019 21:57:49 -0700, John Fastabend wrote: > > > @@ -2042,12 +2060,14 @@ void tls_sw_free_resources_tx(struct sock *sk) > > > if (atomic_read(&ctx->encrypt_pending)) > > > cry

[bpf PATCH] net: tcp_bpf, correctly handle DONT_WAIT flags and timeo == 0

2019-05-13 Thread John Fastabend
rface") Reported-by: Arika Chen Suggested-by: Arika Chen Signed-off-by: John Fastabend --- net/ipv4/tcp_bpf.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 1bb7321a256d..27206b2064db 100644 --- a/net/ipv4/tcp_bpf.c +++

[bpf PATCH 3/3] bpf: sockmap fix msg->sg.size account on ingress skb

2019-05-13 Thread John Fastabend
sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/skmsg.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 49d1efa329d7..93bffaad2135 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -411,6 +411,7

[bpf PATCH 2/3] bpf: sockmap remove duplicate queue free

2019-05-13 Thread John Fastabend
ned-off-by: John Fastabend --- net/ipv4/tcp_bpf.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 1bb7321a256d..4a619c85daed 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -528,8 +528,6 @@ static void tcp_bpf_remove(struct sock *

[bpf PATCH 1/3] bpf: sockmap, only stop/flush strp if it was enabled at some point

2019-05-13 Thread John Fastabend
2ad9 ("bpf: Stop the psock parser before canceling its work") Signed-off-by: John Fastabend --- net/core/skmsg.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index cc94d921476c..49d1efa329d7 100644 --- a/net/core/skmsg

[bpf PATCH 0/3] sockmap fixes

2019-05-13 Thread John Fastabend
A couple fixes for sockmap code. Previously this was bundled with a tls fix for unhash() path however, that is becoming a larger fix so push these on their own. --- John Fastabend (3): bpf: sockmap, only stop/flush strp if it was enabled at some point bpf: sockmap remove duplicate

Re: [bpf PATCH v4 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-05-10 Thread John Fastabend
Jakub Kicinski wrote: > On Thu, 09 May 2019 21:57:49 -0700, John Fastabend wrote: > > @@ -2042,12 +2060,14 @@ void tls_sw_free_resources_tx(struct sock *sk) > > if (atomic_read(&ctx->encrypt_pending)) > > crypto_wait_req(-EINPROGRESS, &ctx->asyn

RE: [PATCH net 2/2] net/tls: handle errors from padding_length()

2019-05-10 Thread John Fastabend
Jakub Kicinski wrote: > At the time padding_length() is called the record header > is still part of the message. If malicious TLS 1.3 peer > sends an all-zero record padding_length() will stop at > the record header, and return full length of the data > including the tail_size. > > Subsequent sub

RE: [PATCH net 1/2] net/tls: remove set but not used variables

2019-05-10 Thread John Fastabend
cinski > Reviewed-by: Dirk van der Merwe > --- > net/tls/tls_device.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > Acked-by: John Fastabend

[bpf PATCH v4 4/4] bpf: sockmap fix msg->sg.size account on ingress skb

2019-05-09 Thread John Fastabend
sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/skmsg.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 49d1efa329d7..93bffaad2135 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -411,6 +411,7

[bpf PATCH v4 2/4] bpf: sockmap, only stop/flush strp if it was enabled at some point

2019-05-09 Thread John Fastabend
2ad9 ("bpf: Stop the psock parser before canceling its work") Signed-off-by: John Fastabend --- net/core/skmsg.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index cc94d921476c..49d1efa329d7 100644 --- a/net/core/skmsg

[bpf PATCH v4 3/4] bpf: sockmap remove duplicate queue free

2019-05-09 Thread John Fastabend
ned-off-by: John Fastabend --- net/ipv4/tcp_bpf.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 1bb7321a256d..4a619c85daed 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -528,8 +528,6 @@ static void tcp_bpf_remove(struct sock *

[bpf PATCH v4 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-05-09 Thread John Fastabend
kTLS code paths. Second we add an 'if(ctx)' check to ensure the ctx is still valid and not released from a previous unhash/close path. Fixes: d91c3e17f75f2 ("net/tls: Only attach to sockets in ESTABLISHED state") Reported-by: Eric Dumazet Signed-off-by: John Fastabend --

[bpf PATCH v4 0/4] sockmap/ktls fixes

2019-05-09 Thread John Fastabend
offloads need to keep ctx around long enough to free in-flight context. We will need a follow up fix for this. --- John Fastabend (4): bpf: tls, implement unhash to avoid transition out of ESTABLISHED bpf: sockmap, only stop/flush strp if it was enabled at some point bpf

Re: kTLS broken somewhere between 4.18 and 5.0

2019-05-07 Thread John Fastabend
Andre Tomt wrote: > On 14.04.2019 22:40, John Fastabend wrote: > > On 4/13/19 6:56 PM, Andre Tomt wrote: > >> On 13.04.2019 17:34, Steinar H. Gunderson wrote: > >>> Hi, > >>> > >>> I've been using kTLS for a while, with my video reflecto

Re: [bpf-next PATCH v3 0/4] sockmap/ktls fixes

2019-05-02 Thread John Fastabend
On 4/30/19 7:06 PM, John Fastabend wrote: > Series of fixes for sockmap and ktls, see patches for descriptions. > > v2: fix build issue for CONFIG_TLS_DEVICE and fixup couple comments > from Jakub > > v3: fix issue where release could call unhash resulting in a use after

[bpf-next PATCH v3 4/4] bpf: sockmap, only stop/flush strp if it was enabled at some point

2019-04-30 Thread John Fastabend
2ad9 ("bpf: Stop the psock parser before canceling its work") Signed-off-by: John Fastabend --- net/core/skmsg.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 782ae9eb4dce..93bffaad2135 100644 --- a/net/core/skmsg

[bpf-next PATCH v3 1/4] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-04-30 Thread John Fastabend
kTLS code paths. Second we add an 'if(ctx)' check to ensure the ctx is still valid and not released from a previous unhash/close path. Fixes: d91c3e17f75f2 ("net/tls: Only attach to sockets in ESTABLISHED state") Reported-by: Eric Dumazet Signed-off-by: John Fastabend --

[bpf-next PATCH v3 2/4] bpf: sockmap remove duplicate queue free

2019-04-30 Thread John Fastabend
ned-off-by: John Fastabend --- net/ipv4/tcp_bpf.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 1bb7321a256d..4a619c85daed 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -528,8 +528,6 @@ static void tcp_bpf_remove(struct sock *

[bpf-next PATCH v3 3/4] bpf: sockmap fix msg->sg.size account on ingress skb

2019-04-30 Thread John Fastabend
sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/skmsg.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index cc94d921476c..782ae9eb4dce 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -411,6 +411,7

[bpf-next PATCH v3 0/4] sockmap/ktls fixes

2019-04-30 Thread John Fastabend
the ulp ptr is needed for the hardware teardown but this is buggy for sure. Its not clear to me how to resolve the hw issue at the moment so fix the sw path why we discuss it. --- John Fastabend (4): bpf: tls, implement unhash to avoid transition out of ESTABLISHED bpf

Re: [bpf PATCH v2 1/3] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-04-25 Thread John Fastabend
On 4/25/19 12:32 PM, John Fastabend wrote: > On 4/25/19 12:29 PM, Jakub Kicinski wrote: >> On Thu, 25 Apr 2019 09:03:08 -0700, John Fastabend wrote: >>> +static void tls_sk_proto_unhash(struct sock *sk) >>> +{ >>> + struct tls_context *ctx = tls_get_ctx

Re: [bpf PATCH v2 1/3] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-04-25 Thread John Fastabend
On 4/25/19 12:29 PM, Jakub Kicinski wrote: > On Thu, 25 Apr 2019 09:03:08 -0700, John Fastabend wrote: >> +static void tls_sk_proto_unhash(struct sock *sk) >> +{ >> +struct tls_context *ctx = tls_get_ctx(sk); >> +void (*sk_proto_unhash)(struct sock

Re: [bpf PATCH v2 0/3] sockmap/ktls fixes

2019-04-25 Thread John Fastabend
On 4/25/19 11:30 AM, Jakub Kicinski wrote: > On Thu, 25 Apr 2019 09:02:50 -0700, John Fastabend wrote: >> Series of fixes for sockmap and ktls, see patches for descriptions. >> >> v2: fix build issue for CONFIG_TLS_DEVICE and fixup couple comments from >> Jakub. >

[bpf PATCH v2 2/3] bpf: sockmap remove duplicate queue free

2019-04-25 Thread John Fastabend
ned-off-by: John Fastabend --- net/ipv4/tcp_bpf.c |2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 1bb7321a256d..4a619c85daed 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -528,8 +528,6 @@ static void tcp_bpf_remove(struct sock *

[bpf PATCH v2 3/3] bpf: sockmap fix msg->sg.size account on ingress skb

2019-04-25 Thread John Fastabend
sockmap: convert to generic sk_msg interface") Signed-off-by: John Fastabend --- net/core/skmsg.c |1 + 1 file changed, 1 insertion(+) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index cc94d921476c..782ae9eb4dce 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -411,6 +411,7

[bpf PATCH v2 1/3] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-04-25 Thread John Fastabend
kTLS code paths. Second we add an 'if(ctx)' check to ensure the ctx is still valid and not released from a previous unhash/close path. Fixes: d91c3e17f75f2 ("net/tls: Only attach to sockets in ESTABLISHED state") Reported-by: Eric Dumazet Signed-off-by: John Fastabend --

[bpf PATCH v2 0/3] sockmap/ktls fixes

2019-04-25 Thread John Fastabend
Series of fixes for sockmap and ktls, see patches for descriptions. v2: fix build issue for CONFIG_TLS_DEVICE and fixup couple comments from Jakub. --- John Fastabend (3): bpf: tls, implement unhash to avoid transition out of ESTABLISHED bpf: sockmap remove duplicate queue free

Re: [bpf PATCH 1/3] bpf: tls, implement unhash to avoid transition out of ESTABLISHED

2019-04-24 Thread John Fastabend
On 4/24/19 8:07 PM, Jakub Kicinski wrote: > On Wed, 24 Apr 2019 12:21:03 -0700, John Fastabend wrote: >> It is possible (via shutdown()) for TCP socks to go through TCP_CLOSE >> state via tcp_disconnect() without calling into close callback. This >> would allow a kTLS en

[bpf-next PATCH] bpf: sockmap, test tool support to skip cgroup arg

2019-04-24 Thread John Fastabend
Its handy to not have to setup a cgroup environment when running test_sockmap with user specified options. This patch setups a cgroup environment, similar to how it is done with the auto test suite, when the user does not provide a cgroup arg. Signed-off-by: John Fastabend --- tools/testing

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