aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_main.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-12-20 17:47:10 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2018-12-20 17:47:11 -0500
commit1cf4a0ccc506b5c027afc5eaf3fddc83f96f31e7 (patch)
treecd64f2bdd6ac693f204b18938c5836df2bcc698e /net/tls/tls_main.c
parent77ea5f4cbe2084db9ab021ba73fb7eadf1610884 (diff)
parent28cb6f1eaffdc5a6a9707cac55f4a43aa3fd7895 (diff)
Merge branch 'bpf-sockmap-fixes-and-improvements'
John Fastabend says: ==================== Set of bpf fixes and improvements to make sockmap with kTLS usable with "real" applications. This set came as the fallout of pulling kTLS+sockmap into Cilium[1] and running in container environment. Roughly broken into three parts, Patches 1-3: resolve/improve handling of size field in sk_msg_md Patch 4: it became difficult to use this in Cilium when the SK_PASS verdict was not correctly handle. So handle the case correctly. Patch 5-8: Set of issues found while running OpenSSL TX kTLS enabled applications. This resolves the most obvious issues and gets applications using kTLS TX up and running with sock{map|has}. Other than the "sk_msg, zap ingress queue on psock down" (PATCH 6/8) which can potentially cause a WARNING the issues fixed in this series do not cause kernel side warnings, BUG, etc. but instead cause stalls and other odd behavior in the user space applications when using kTLS with BPF policies applied. Primarily tested with 'curl' compiled with latest openssl and also 'openssl s_client/s_server' containers using Cilium network plugin with docker/k8s. Some basic testing with httpd was also enabled. Cilium CI tests will be added shortly to cover these cases as well. We also have 'wrk' and other test and benchmarking tools we can run now. We have two more sets of patches currently under testing that will be sent shortly to address a few more issues. First the OpenSSL RX kTLS side breaks when both sk_msg and sk_skb_verdict programs are used with kTLS, the sk_skb_verdict programs are not enforced. Second skmsg needs to call into tcp stack to send to indicate consumed data. ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r--net/tls/tls_main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 311cec8e533d..acff12999c06 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -55,6 +55,8 @@ enum {
55 55
56static struct proto *saved_tcpv6_prot; 56static struct proto *saved_tcpv6_prot;
57static DEFINE_MUTEX(tcpv6_prot_mutex); 57static DEFINE_MUTEX(tcpv6_prot_mutex);
58static struct proto *saved_tcpv4_prot;
59static DEFINE_MUTEX(tcpv4_prot_mutex);
58static LIST_HEAD(device_list); 60static LIST_HEAD(device_list);
59static DEFINE_MUTEX(device_mutex); 61static DEFINE_MUTEX(device_mutex);
60static struct proto tls_prots[TLS_NUM_PROTS][TLS_NUM_CONFIG][TLS_NUM_CONFIG]; 62static struct proto tls_prots[TLS_NUM_PROTS][TLS_NUM_CONFIG][TLS_NUM_CONFIG];
@@ -690,6 +692,16 @@ static int tls_init(struct sock *sk)
690 mutex_unlock(&tcpv6_prot_mutex); 692 mutex_unlock(&tcpv6_prot_mutex);
691 } 693 }
692 694
695 if (ip_ver == TLSV4 &&
696 unlikely(sk->sk_prot != smp_load_acquire(&saved_tcpv4_prot))) {
697 mutex_lock(&tcpv4_prot_mutex);
698 if (likely(sk->sk_prot != saved_tcpv4_prot)) {
699 build_protos(tls_prots[TLSV4], sk->sk_prot);
700 smp_store_release(&saved_tcpv4_prot, sk->sk_prot);
701 }
702 mutex_unlock(&tcpv4_prot_mutex);
703 }
704
693 ctx->tx_conf = TLS_BASE; 705 ctx->tx_conf = TLS_BASE;
694 ctx->rx_conf = TLS_BASE; 706 ctx->rx_conf = TLS_BASE;
695 update_sk_prot(sk, ctx); 707 update_sk_prot(sk, ctx);
@@ -721,8 +733,6 @@ static struct tcp_ulp_ops tcp_tls_ulp_ops __read_mostly = {
721 733
722static int __init tls_register(void) 734static int __init tls_register(void)
723{ 735{
724 build_protos(tls_prots[TLSV4], &tcp_prot);
725
726 tls_sw_proto_ops = inet_stream_ops; 736 tls_sw_proto_ops = inet_stream_ops;
727 tls_sw_proto_ops.splice_read = tls_sw_splice_read; 737 tls_sw_proto_ops.splice_read = tls_sw_splice_read;
728 738