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 +, John Fastabend wrote: > > > > @@ -352,15 +354,18 @@ static void tls_sk_proto_close(struct sock *sk, > > > > long timeout) > > > > if (ctx-

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

2019-07-10 Thread Jakub Kicinski
On Tue, 09 Jul 2019 20:33:58 -0700, John Fastabend wrote: > Jakub Kicinski wrote: > > On Mon, 08 Jul 2019 19:15:18 +, 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 ==

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 +, 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) > > goto skip_tx_cleanup; > > > > - sk->sk

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

2019-07-09 Thread Jakub Kicinski
On Mon, 08 Jul 2019 19:15:18 +, 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) > goto skip_tx_cleanup; > > - sk->sk_prot = ctx->sk_proto; >

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

2019-07-09 Thread Jakub Kicinski
On Mon, 08 Jul 2019 19:15:18 +, John Fastabend wrote: > @@ -836,22 +841,39 @@ static int tls_init(struct sock *sk) There is a goto out above this which has to be turned into return 0; if out now releases the lock. > if (sk->sk_state != TCP_ESTABLISHED) > return -ENOTSUPP;

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

2019-07-08 Thread John Fastabend
When a map free is called and in parallel a socket is closed we have two paths that can potentially reset the socket prot ops, the bpf close() path and the map free path. This creates a problem with which prot ops should be used from the socket closed side. If the map_free side completes first the