From: Juan Agustin Niccolini <juanagusnicco@gmail.com>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org, Eddy Tsalolikhin <eddsterxyz@gmail.com>,
Kyle Zeng <kylebot@openai.com>,
John Fastabend <john.fastabend@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Sabrina Dubroca <sd@queasysnail.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice
Date: Mon, 23 Nov 2026 01:30:55 -0500 [thread overview]
Message-ID: <20261123063055.58813-1-juanagusnicco@gmail.com> (raw)
In-Reply-To: <20261120225720.89044-1-jiayuan.chen@linux.dev>
On Sat, 21 Nov 2026 06:57:19 +0800, Jiayuan Chen wrote:
> tls_sw_sendmsg_splice() forces sg.curr = sg.end after adding the
> spliced page.
>
> The following non-splice sk_msg_memcopy_from_iter() is a do-while
> loop: it advances i with sk_msg_iter_var_next() and only then tests
> i != sg.end, so starting from sg.curr == sg.end it wraps the ring.
I don't think this addresses the root cause. The copy path in
tls_sw_sendmsg_locked() starts writing at whatever cursor the last
producer left behind, and this is the second time the splice line has
been fixed because of that: c5a595000e26 made it move sg.curr because
the copy was writing into the spliced page, and that change is what
introduced this bug.
This patch does close the splice route on mainline but doesn't touch
multiple producers that leave the scatterlist cursor in a bad state
for the next copy:
- tls_sw_do_sendpage() on 6.1, 5.15 and 5.10, where this patch does
not apply. The bug is reachable there too, as a race rather than
deterministically (won within a second in my tests).
- the record split in tls_push_record() on 7.1 and older.
The copy path always appends after the data already in the record, so
it can set the cursor itself, in tls_clone_plaintext_msg(), before
cloning: on the last element with copybreak at its length, or at
sg.start when the record is empty, as sk_msg_reset_curr() does. That
holds whether the clone grows the last element or adds a new one,
covers every producer, would have made c5a595000e26 unnecessary, and
applies unchanged to every stable branch.
I'll send it as a separate patch that tags d829e9c4112b which caused the
symptom that c5a595000e26 fixed but introduced this bug.
Best,
Agustin
prev parent reply other threads:[~2026-11-23 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 22:57 [PATCH net v1] tls: fix ring wrap in sk_msg_memcopy_from_iter() after splice Jiayuan Chen
2026-11-20 23:03 ` netdev-bot+sinfo
2026-11-23 6:30 ` Juan Agustin Niccolini [this message]
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=20261123063055.58813-1-juanagusnicco@gmail.com \
--to=juanagusnicco@gmail.com \
--cc=davem@davemloft.net \
--cc=eddsterxyz@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=kylebot@openai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox