netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/8] net: tls: fix scatter-gather list issues
@ 2019-11-27 20:16 Jakub Kicinski
  2019-11-27 20:16 ` [PATCH net 1/8] net/tls: take into account that bpf_exec_tx_verdict() may free the record Jakub Kicinski
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Jakub Kicinski @ 2019-11-27 20:16 UTC (permalink / raw)
  To: davem, john.fastabend
  Cc: netdev, oss-drivers, borisp, aviadye, daniel, Jakub Kicinski

Hi!

This series kicked of by a syzbot report fixes three issues around
scatter gather handling in the TLS code. First patch fixes a use-
-after-free situation which may occur if record was freed on error.
This could have already happened in BPF paths, and patch 2 now makes
the same condition occur in non-BPF code.

Patch 2 fixes the problem spotted by syzbot. If encryption failed
we have to clean the end markings from scatter gather list. As
suggested by John the patch frees the record entirely and caller
may retry copying data from user space buffer again.

Third patch fixes a bug in the TLS 1.3 code spotted while working
on patch 2. TLS 1.3 may effectively overflow the SG list which
leads to the BUG() in sg_page() being triggered.

Patch 4 adds a test case which triggers this bug reliably.

Next two patches are small cleanups of dead code and code which
makes dangerous assumptions.

Last but not least two minor improvements to the sockmap tests.

Tested:
 - bpf/test_sockmap
 - net/tls
 - syzbot repro (which used error injection, hence no direct
   selftest is added to preserve it).

Jakub Kicinski (8):
  net/tls: take into account that bpf_exec_tx_verdict() may free the
    record
  net/tls: free the record on encryption error
  net: skmsg: fix TLS 1.3 crash with full sk_msg
  selftests/tls: add a test for fragmented messages
  net/tls: remove the dead inplace_crypto code
  net/tls: use sg_next() to walk sg entries
  selftests: bpf: test_sockmap: handle file creation failures gracefully
  selftests: bpf: correct perror strings

 include/linux/skmsg.h                      | 28 +++++-----
 include/net/tls.h                          |  3 +-
 net/core/filter.c                          |  8 +--
 net/core/skmsg.c                           |  2 +-
 net/ipv4/tcp_bpf.c                         |  2 +-
 net/tls/tls_main.c                         | 13 +----
 net/tls/tls_sw.c                           | 32 +++++++-----
 tools/testing/selftests/bpf/test_sockmap.c | 47 ++++++++++-------
 tools/testing/selftests/bpf/xdping.c       |  2 +-
 tools/testing/selftests/net/tls.c          | 60 ++++++++++++++++++++++
 10 files changed, 131 insertions(+), 66 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-11-29  6:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 20:16 [PATCH net 0/8] net: tls: fix scatter-gather list issues Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 1/8] net/tls: take into account that bpf_exec_tx_verdict() may free the record Jakub Kicinski
2019-11-28  4:40   ` John Fastabend
2019-11-27 20:16 ` [PATCH net 2/8] net/tls: free the record on encryption error Jakub Kicinski
2019-11-28  4:41   ` John Fastabend
2019-11-27 20:16 ` [PATCH net 3/8] net: skmsg: fix TLS 1.3 crash with full sk_msg Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 4/8] selftests/tls: add a test for fragmented messages Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 5/8] net/tls: remove the dead inplace_crypto code Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 6/8] net/tls: use sg_next() to walk sg entries Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 7/8] selftests: bpf: test_sockmap: handle file creation failures gracefully Jakub Kicinski
2019-11-27 20:16 ` [PATCH net 8/8] selftests: bpf: correct perror strings Jakub Kicinski
2019-11-29  6:44 ` [PATCH net 0/8] net: tls: fix scatter-gather list issues David Miller

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).