Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Jiayuan Chen
Fri, 16 Oct 2026 10:13
Re: [PATCH net v2 0/2] kcm: don't sleep in softirq when the lower socket uses kTLS
Author: Jiayuan Chen
Date: Fri, 16 Oct 2026 10:13
Date: Fri, 16 Oct 2026 10:13
57 lines
8255 bytes
8255 bytes
On 10/16/26 10:44 AM, Rishikesh Jethwani wrote: > When a TCP socket with software kTLS RX is attached to a KCM mux, Can we just reject such combo ? > psock_data_ready() calls strp_data_ready() from softirq, which calls the > socket's read_sock(). For kTLS that is tls_sw_read_sock(), which can > sleep, and CONFIG_DEBUG_ATOMIC_SLEEP reports it on every run of a > loopback reproducer. > > Patch 1 is the fix: KCM parses inline only when read_sock is > tcp_read_sock() and otherwise defers to the strparser work, which runs > under lock_sock(). It applies and builds on its own, including on > stable kernels. > > Patch 2 addresses review feedback on v1 and is needed by patch 1. > kstrp, the workqueue that deferred work runs on, is an ordered > workqueue shared by every strparser user (KCM, sockmap, espintcp, > ovpn). With patch 1 alone, a KCM psock decrypting kTLS records in > software on kstrp would delay parsing and message timeouts for every > other strparser socket on the system. Patch 2 makes kstrp per-CPU. It > has no Fixes tag: the ordered workqueue is as old as strparser, and it > only becomes a real problem for KCM over kTLS with patch 1. > > Other strparser users are not affected by the bug fixed in patch 1: > espintcp is itself a TCP ULP and cannot be combined with kTLS, ovpn > installs its own ops built from inet_stream_ops, and sockmap reads > through tcp_bpf_strp_read_sock() and is mutually exclusive with kTLS > RX (do_tls_setsockopt_conf() rejects sockets with a psock). > > Testing: with patch 1, 5/5 runs of the reproducer produce no splat and > full datagram delivery; without it every run hits "BUG: sleeping > function called from invalid context" in strp_data_ready -> > tls_sw_read_sock. Multi-record messages (>16 KiB each) also deliver > completely with kTLS RX installed before the KCM attach and the whole > stream queued before the reader starts. With patch 2, test_sockmap and the ovpn TCP selftests > pass, strparser work runs concurrently across sockets, and dmesg shows > no warnings. > > v2: > - add patch 2 (kstrp per-CPU), per review > - read sock->ops with READ_ONCE(), pairing with update_sk_prot() > > v1: https://lore.kernel.org/netdev/20261013033920.2069285-1-rjethwani@purestorage.com/ > > Rishikesh Jethwani (2): > kcm: defer receive parsing when the lower socket's read_sock may sleep > strparser: don't serialize all parser work on one ordered workqueue > > net/kcm/kcmsock.c | 33 +++++++++++++++++++++++++++++++-- > net/strparser/strparser.c | 2 +- > 2 files changed, 32 insertions(+), 3 deletions(-) >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads