bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>, bpf@vger.kernel.org
Cc: netdev@vger.kernel.org, kernel-team@cloudflare.com,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>
Subject: RE: [PATCH bpf-next 3/3] selftests/bpf: Test unhashing kTLS socket after removing from map
Date: Tue, 18 Feb 2020 22:22:26 -0800	[thread overview]
Message-ID: <5e4cd422daa81_404b2ac01efba5b4c8@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20200217121530.754315-4-jakub@cloudflare.com>

Jakub Sitnicki wrote:
> When a TCP socket gets inserted into a sockmap, its sk_prot callbacks get
> replaced with tcp_bpf callbacks built from regular tcp callbacks. If TLS
> gets enabled on the same socket, sk_prot callbacks get replaced once again,
> this time with kTLS callbacks built from tcp_bpf callbacks.
> 
> Now, we allow removing a socket from a sockmap that has kTLS enabled. After
> removal, socket remains with kTLS configured. This is where things things
> get tricky.
> 
> Since the socket has a set of sk_prot callbacks that are a mix of kTLS and
> tcp_bpf callbacks, we need to restore just the tcp_bpf callbacks to the
> original ones. At the moment, it comes down to the the unhash operation.
> 
> We had a regression recently because tcp_bpf callbacks were not cleared in
> this particular scenario of removing a kTLS socket from a sockmap. It got
> fixed in commit 4da6a196f93b ("bpf: Sockmap/tls, during free we may call
> tcp_bpf_unhash() in loop").
> 
> Add a test that triggers the regression so that we don't reintroduce it in
> the future.
> 
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
> ---
>  .../selftests/bpf/prog_tests/sockmap_ktls.c   | 123 ++++++++++++++++++
>  1 file changed, 123 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c
> 

I'll push the patches I have on my stack to run some more of the
sockmap tests with ktls this week as well to get our coverage up.

Acked-by: John Fastabend <john.fastabend@gmail.com>

  reply	other threads:[~2020-02-19  6:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 12:15 [PATCH bpf-next 0/3] sockmap/ktls: Simplify how we restore sk_prot callbacks Jakub Sitnicki
2020-02-17 12:15 ` [PATCH bpf-next 1/3] bpf, sk_msg: Let ULP restore sk_proto and write_space callback Jakub Sitnicki
2020-02-19  6:09   ` John Fastabend
2020-02-17 12:15 ` [PATCH bpf-next 2/3] bpf, sk_msg: Don't clear saved sock proto on restore Jakub Sitnicki
2020-02-19  6:19   ` John Fastabend
2020-02-17 12:15 ` [PATCH bpf-next 3/3] selftests/bpf: Test unhashing kTLS socket after removing from map Jakub Sitnicki
2020-02-19  6:22   ` John Fastabend [this message]
2020-02-19 17:36 ` [PATCH bpf-next 0/3] sockmap/ktls: Simplify how we restore sk_prot callbacks Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e4cd422daa81_404b2ac01efba5b4c8@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).