From: Sabrina Dubroca <sd@queasysnail.net>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Donald Hunter <donald.hunter@gmail.com>,
Shuah Khan <shuah@kernel.org>,
ryazanov.s.a@gmail.com, Andrew Lunn <andrew+netdev@lunn.ch>,
Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Xiao Liang <shaw.leon@gmail.com>,
David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next v20 12/25] ovpn: implement TCP transport
Date: Sun, 2 Mar 2025 19:59:20 +0100 [thread overview]
Message-ID: <Z8SqiJedxrFhGuB9@hog> (raw)
In-Reply-To: <20250227-b4-ovpn-v20-12-93f363310834@openvpn.net>
2025-02-27, 02:21:37 +0100, Antonio Quartulli wrote:
> Moreover export tcp_release_cb by means of EXPORT_SYMBOL instead of
> EXPORT_IPV6_MOD, so that other modules can use it, even if IPV6 is
> not compiled in.
Is that really needed? You're saving tcp.sk_cb.prot, so you could just
call peer->tcp.sk_cb.prot->release_cb? (with a bit of care since it's
called after peer_put)
[I don't know what the maintainers' preference is wrt "re-exporting"
symbols that got moved to EXPORT_IPV6_MOD]
[...]
> +static void ovpn_tcp_send_sock(struct ovpn_peer *peer, struct sock *sk)
> +{
> + struct sk_buff *skb = peer->tcp.out_msg.skb;
> +
> + if (!skb)
> + return;
> +
> + if (peer->tcp.tx_in_progress)
> + return;
> +
> + peer->tcp.tx_in_progress = true;
> +
> + do {
> + int ret = skb_send_sock_locked(sk, skb,
> + peer->tcp.out_msg.offset,
> + peer->tcp.out_msg.len);
> + if (unlikely(ret < 0)) {
> + if (ret == -EAGAIN)
> + goto out;
> +
> + net_warn_ratelimited("%s: TCP error to peer %u: %d\n",
> + netdev_name(peer->ovpn->dev),
> + peer->id, ret);
> +
> + /* in case of TCP error we can't recover the VPN
> + * stream therefore we abort the connection
> + */
> + ovpn_peer_del(peer,
> + OVPN_DEL_PEER_REASON_TRANSPORT_ERROR);
I don't think this works:
ovpn_peer_del -> unlock_ovpn -> ovpn_socket_release -> might_sleep
but we can get to ovpn_tcp_send_sock in a few contexts that are not
allowed to sleep:
ovpn_tcp_send_skb -> ovpn_tcp_send_sock_skb -> ovpn_tcp_send_sock
__sk_flush_backlog -> release_cb = ovpn_tcp_release -> ovpn_tcp_send_sock_skb
release_sock -> release_cb = ovpn_tcp_release -> ovpn_tcp_send_sock_skb
(I checked all other paths leading to unlock_ovpn/ovpn_socket_release,
this is the only one I could find that is not allowed to sleep. So it
would likely be easier to push this peer_del (or even just the
handling of release_list) into some other sleepable context than
trying to reshuffle all the other paths)
--
Sabrina
next prev parent reply other threads:[~2025-03-02 18:59 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 1:21 [PATCH net-next v20 00/25] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 01/25] mailmap: remove unwanted entry for Antonio Quartulli Antonio Quartulli
2025-02-27 1:30 ` Antonio Quartulli
2025-02-27 3:05 ` Jakub Kicinski
2025-02-27 1:21 ` [PATCH net-next v20 02/25] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 03/25] ovpn: add basic netlink support Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 04/25] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 05/25] ovpn: keep carrier always on for MP interfaces Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 06/25] ovpn: introduce the ovpn_peer object Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 07/25] ovpn: introduce the ovpn_socket object Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 08/25] ovpn: implement basic TX path (UDP) Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 09/25] ovpn: implement basic RX " Antonio Quartulli
2025-02-28 15:25 ` Sabrina Dubroca
2025-03-03 14:47 ` Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 10/25] ovpn: implement packet processing Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 11/25] ovpn: store tunnel and transport statistics Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 12/25] ovpn: implement TCP transport Antonio Quartulli
2025-03-02 18:59 ` Sabrina Dubroca [this message]
2025-03-02 20:59 ` Antonio Quartulli
2025-03-03 15:08 ` Sabrina Dubroca
2025-03-03 15:48 ` Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 13/25] skb: implement skb_send_sock_locked_with_flags() Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 14/25] ovpn: add support for MSG_NOSIGNAL in tcp_sendmsg Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 15/25] ovpn: implement multi-peer support Antonio Quartulli
2025-03-03 13:08 ` Sabrina Dubroca
2025-03-03 14:45 ` Antonio Quartulli
2025-03-03 15:38 ` Sabrina Dubroca
2025-02-27 1:21 ` [PATCH net-next v20 16/25] ovpn: implement peer lookup logic Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 17/25] ovpn: implement keepalive mechanism Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 18/25] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 19/25] ovpn: add support for peer floating Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 20/25] ovpn: implement peer add/get/dump/delete via netlink Antonio Quartulli
2025-03-02 18:24 ` Sabrina Dubroca
2025-03-02 21:00 ` Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 21/25] ovpn: implement key add/get/del/swap " Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 22/25] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 23/25] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 24/25] ovpn: add basic ethtool support Antonio Quartulli
2025-02-27 1:21 ` [PATCH net-next v20 25/25] testing/selftests: add test tool and scripts for ovpn module Antonio Quartulli
2025-02-27 16:21 ` [PATCH net-next v20 00/25] Introducing OpenVPN Data Channel Offload Jakub Kicinski
2025-02-28 14:21 ` Antonio Quartulli
2025-02-28 1:40 ` patchwork-bot+netdevbpf
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=Z8SqiJedxrFhGuB9@hog \
--to=sd@queasysnail.net \
--cc=andrew+netdev@lunn.ch \
--cc=antonio@openvpn.net \
--cc=donald.hunter@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=shaw.leon@gmail.com \
--cc=shuah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.