From: netdev-bot+sashiko@kernel.org
To: cel@kernel.org
Cc: john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net,
davem@davemloft.net, pabeni@redhat.com, horms@kernel.org,
davejwatson@fb.com, shuah@kernel.org, qingfang.deng@linux.dev,
edumazet@kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v6 8/9] selftests: tls: Extend coverage for zero-length records
Date: Thu, 22 Oct 2026 19:57:37 +0000 [thread overview]
Message-ID: <179269905793.1189532.10522541488678622443@kernel.org> (raw)
In-Reply-To: <20261019-tls-follow-on-v6-8-ab01c4ecca0c@kernel.org>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] This patch adds TEST_F(zero_len_splice, test) in
tools/testing/selftests/net/tls.c.
--
selftests: tls: Extend coverage for zero-length records
This adds the zero_len_splice and zero_len_peek fixtures to the TLS
selftests. They check that splice() and MSG_PEEK get past runs of
zero-length application_data records. It also adds a data_0data_data
variant to zero_len, which checks that recv() does not read through an
empty record sitting between two data records.
> diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
> index 0bc43728262e..aa66d0bbd1b5 100644
> --- a/tools/testing/selftests/net/tls.c
> +++ b/tools/testing/selftests/net/tls.c
[ ... ]
> +/* Splicing must skip a run of empty data records to reach the payload
> + * behind it, since a zero-byte splice reads as EOF. Splice reports
> + * EAGAIN for a run with no payload behind it, and EINVAL for a control
> + * record behind the run.
> + */
> +TEST_F(zero_len_splice, test)
> +{
> + struct pollfd pfd = { .fd = self->cfd, .events = POLLIN };
> + const struct raw_rec *payload;
> + unsigned char buf[128];
> + ssize_t ret;
> + int p[2];
> +
> + if (self->notls)
> + SKIP(return, "no TLS support");
> +
> + ASSERT_GE(pipe(p), 0);
> +
> + payload = zero_len_send_recs(_metadata, self->fd, variant->recs);
> +
> + if (variant->splice_ret < 0) {
> + ret = splice(self->cfd, NULL, p[1], NULL, sizeof(buf),
> + SPLICE_F_NONBLOCK);
> + EXPECT_EQ(ret, -1);
> + EXPECT_EQ(errno, -variant->splice_ret);
> + } else {
> + /* ASSERT so a zero return stops the test before the read
> + * below blocks until the harness timeout.
> + */
> + ASSERT_EQ(splice(self->cfd, NULL, p[1], NULL, sizeof(buf),
> + SPLICE_F_NONBLOCK), variant->splice_ret);
[Severity: Low]
Both splice() calls in TEST_F(zero_len_splice, test) pass
SPLICE_F_NONBLOCK, and nothing sets O_NONBLOCK on cfd. Is the socket
O_NONBLOCK path in tls_sw_splice_read() ever covered by this test?
net/tls/tls_sw.c:tls_sw_splice_read() {
...
nonblock = (flags & SPLICE_F_NONBLOCK) ||
(sock->file->f_flags & O_NONBLOCK);
...
}
The earlier commit "tls: Honor O_NONBLOCK in tls_sw_splice_read()"
added the f_flags check above. It names this selftest, run on a
nonblocking socket, as its reproducer.
As of this patch, SPLICE_F_NONBLOCK on its own makes the wait return
-EAGAIN. A kernel that lost the O_NONBLOCK term would still pass every
zero_len_splice variant.
This looks resolved later in the series. "selftests: tls: Cover splice
on a nonblocking socket" moves the body into zero_len_do_splice() with
a splice_flags parameter. It also adds TEST_F(zero_len_splice,
nonblock_socket), which sets O_NONBLOCK on cfd with fcntl(F_SETFL) and
then splices with flags 0.
Would it make sense to fold that coverage into this patch, so the
reproducer named by the fix is in place from the start?
> + ret = read(p[0], buf, sizeof(buf));
> + EXPECT_EQ(ret, variant->splice_ret);
> + if (ret == variant->splice_ret)
> + EXPECT_EQ(memcmp(buf, payload->plain_data,
> + variant->splice_ret), 0);
> +
> + /* The empty records were consumed, not left queued */
> + EXPECT_EQ(poll(&pfd, 1, 0), 0);
> + }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019-tls-follow-on-v6-0-ab01c4ecca0c%40kernel.org
next prev parent reply other threads:[~2026-10-22 19:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 16:55 [PATCH net-next v6 0/9] net/tls: Receive-path fixes for zero-length data records Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 1/9] tls: Bound consecutive no-data records in tls_sw_read_sock() Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko
2026-10-23 15:15 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 2/9] tls: Check for a pending signal after an empty record Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko
2026-10-23 15:18 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 3/9] tls: Honor O_NONBLOCK in tls_sw_splice_read() Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 4/9] tls: Consume empty data records " Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 5/9] tls: Consume empty data records in tls_sw_recvmsg() Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 6/9] tls: Return copied data ahead of a run of empty records Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 7/9] selftests: tls: Skip the zero_len tests when TLS is unavailable Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 8/9] selftests: tls: Extend coverage for zero-length records Chuck Lever
2026-10-22 19:57 ` netdev-bot+sashiko [this message]
2026-10-23 15:20 ` Chuck Lever
2026-10-19 16:55 ` [PATCH net-next v6 9/9] selftests: tls: Cover splice on a nonblocking socket Chuck Lever
2026-10-26 22:37 ` [PATCH net-next v6 0/9] net/tls: Receive-path fixes for zero-length data records Jakub Kicinski
2026-10-27 13:01 ` Chuck Lever
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=179269905793.1189532.10522541488678622443@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=cel@kernel.org \
--cc=davejwatson@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=qingfang.deng@linux.dev \
--cc=sd@queasysnail.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox