[RFC mptcp-next] Squash to "tls: add ops in tls_context"

Geliang Tang posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/95151965c8e5b49c6246c8cbb5f543177c0737de.1768289171.git.tanggeliang@kylinos.cn
There is a newer version of this series
net/tls/tls_main.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
[RFC mptcp-next] Squash to "tls: add ops in tls_context"
Posted by Geliang Tang 1 week, 5 days ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Oops, sorry. spin_lock(&tls_prot_ops_lock) should be called after
write_unlock_bh(&sk->sk_callback_lock); otherwise, a deadlock occurs.

In this fix, tls_prot_ops_find() is moved to after write_unlock_bh(),
and spin_lock_bh()/spin_unlock_bh() are now used.

Based-on: <cover.1768284047.git.tanggeliang@kylinos.cn>

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/tls/tls_main.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 75e01f2dde26..1da7f479342f 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -1097,16 +1097,18 @@ static int tls_init(struct sock *sk)
 	ctx->tx_conf = TLS_BASE;
 	ctx->rx_conf = TLS_BASE;
 	ctx->tx_max_payload_len = TLS_MAX_PAYLOAD_SIZE;
-	spin_lock(&tls_prot_ops_lock);
-	ctx->ops = tls_prot_ops_find(sk->sk_protocol);
-	spin_unlock(&tls_prot_ops_lock);
-	if (!ctx->ops) {
-		rc = -EINVAL;
-		goto out;
-	}
 	update_sk_prot(sk, ctx);
 out:
 	write_unlock_bh(&sk->sk_callback_lock);
+
+	if (!rc) {
+		spin_lock_bh(&tls_prot_ops_lock);
+		ctx->ops = tls_prot_ops_find(sk->sk_protocol);
+		spin_unlock_bh(&tls_prot_ops_lock);
+		if (!ctx->ops)
+			rc = -EINVAL;
+	}
+
 	return rc;
 }
 
-- 
2.51.0
Re: [RFC mptcp-next] Squash to "tls: add ops in tls_context"
Posted by MPTCP CI 1 week, 5 days ago
Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_add_addr 🔴
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 1 failed test(s): packetdrill_add_addr 🔴
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/20948722188

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b2e4c337dc61
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1041596


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Re: [RFC mptcp-next] Squash to "tls: add ops in tls_context"
Posted by MPTCP CI 1 week, 5 days ago
Hi Geliang,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

  https://github.com/multipath-tcp/mptcp_net-next/actions/runs/20948722197

Status: failure
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b2e4c337dc61
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1041596

Feel free to reply to this email if you cannot access logs, if you need
some support to fix the error, if this doesn't seem to be caused by your
modifications or if the error is a false positive one.

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)