mbox series

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

Message ID 155667629056.4128.14102391877350907561.stgit@john-XPS-13-9360
Headers show
Series sockmap/ktls fixes | expand

Message

John Fastabend May 1, 2019, 2:06 a.m. UTC
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
    free. Now we detach the ulp pointer before calling into destroy
    or unhash. This way if we get a callback into unhash from destroy
    path there is no ulp to access. The fallout is we must pass the
    ctx into the functions rather than use the sk lookup in each
    routine. This is probably better anyways.

    @Jakub, I did not fix the hw device case it seems 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: sockmap remove duplicate queue free
      bpf: sockmap fix msg->sg.size account on ingress skb
      bpf: sockmap, only stop/flush strp if it was enabled at some point


 include/net/tls.h    |   24 ++++++++++++---
 net/core/skmsg.c     |    7 +++-
 net/ipv4/tcp_bpf.c   |    2 -
 net/tls/tls_device.c |    6 ++--
 net/tls/tls_main.c   |   78 +++++++++++++++++++++++++++++++++-----------------
 net/tls/tls_sw.c     |   51 ++++++++++++++++-----------------
 6 files changed, 103 insertions(+), 65 deletions(-)

--
Signature

Comments

John Fastabend May 2, 2019, 8:05 p.m. UTC | #1
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
>     free. Now we detach the ulp pointer before calling into destroy
>     or unhash. This way if we get a callback into unhash from destroy
>     path there is no ulp to access. The fallout is we must pass the
>     ctx into the functions rather than use the sk lookup in each
>     routine. This is probably better anyways.
> 
>     @Jakub, I did not fix the hw device case it seems 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.
> 
Unfortunately, this is still failing with hardware offload (thanks
Jakub) so will need a v4 to actually fix this.


Thanks,
John

> ---
> 
> John Fastabend (4):
>       bpf: tls, implement unhash to avoid transition out of ESTABLISHED
>       bpf: sockmap remove duplicate queue free
>       bpf: sockmap fix msg->sg.size account on ingress skb
>       bpf: sockmap, only stop/flush strp if it was enabled at some point
> 
> 
>  include/net/tls.h    |   24 ++++++++++++---
>  net/core/skmsg.c     |    7 +++-
>  net/ipv4/tcp_bpf.c   |    2 -
>  net/tls/tls_device.c |    6 ++--
>  net/tls/tls_main.c   |   78 +++++++++++++++++++++++++++++++++-----------------
>  net/tls/tls_sw.c     |   51 ++++++++++++++++-----------------
>  6 files changed, 103 insertions(+), 65 deletions(-)
> 
> --
> Signature
>
Daniel Borkmann May 6, 2019, 9:18 a.m. UTC | #2
On 05/02/2019 10:05 PM, John Fastabend wrote:
> 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
>>     free. Now we detach the ulp pointer before calling into destroy
>>     or unhash. This way if we get a callback into unhash from destroy
>>     path there is no ulp to access. The fallout is we must pass the
>>     ctx into the functions rather than use the sk lookup in each
>>     routine. This is probably better anyways.
>>
>>     @Jakub, I did not fix the hw device case it seems 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.
>>
> Unfortunately, this is still failing with hardware offload (thanks
> Jakub) so will need a v4 to actually fix this.

Perhaps split off the skmsg fixes from the series so they can already
be applied since they should be independent of the tlx fix?

Thanks,
Daniel