netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: netdev@vger.kernel.org, eadavis@qq.com, kuba@kernel.org
Cc: john.fastabend@gmail.com, bpf@vger.kernel.org, borisp@nvidia.com
Subject: [PATCH net 2/2] net: tls, add test to capture error on large splice
Date: Wed, 10 Jan 2024 14:01:24 -0800	[thread overview]
Message-ID: <20240110220124.452746-3-john.fastabend@gmail.com> (raw)
In-Reply-To: <20240110220124.452746-1-john.fastabend@gmail.com>

syzbot found an error with how splice() is handled with a msg greater
than 32. This was fixed in previous patch, but lets add a test for
it to ensure it continues to work.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 tools/testing/selftests/net/tls.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 464853a7f982..a53117cee841 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -707,6 +707,19 @@ TEST_F(tls, splice_from_pipe)
 	EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0);
 }
 
+TEST_F(tls, splice_more)
+{
+	int send_len = TLS_PAYLOAD_MAX_LEN;
+	char mem_send[TLS_PAYLOAD_MAX_LEN];
+	int i, send_pipe = 1;
+	int p[2];
+
+	ASSERT_GE(pipe(p), 0);
+	EXPECT_GE(write(p[1], mem_send, send_len), 0);
+	for (i = 0; i < 32; i++)
+		EXPECT_EQ(splice(p[0], NULL, self->fd, NULL, send_pipe, 0xe), 1);
+}
+
 TEST_F(tls, splice_from_pipe2)
 {
 	int send_len = 16000;
-- 
2.33.0


  parent reply	other threads:[~2024-01-10 22:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 22:01 [PATCH net 0/2] tls fixes for SPLICE with more hint John Fastabend
2024-01-10 22:01 ` [PATCH net 1/2] net: tls, fix WARNIING in __sk_msg_free John Fastabend
2024-01-12  1:05   ` Jakub Kicinski
2024-01-10 22:01 ` John Fastabend [this message]
2024-01-12  1:05   ` [PATCH net 2/2] net: tls, add test to capture error on large splice Jakub Kicinski
2024-01-12 21:52     ` John Fastabend

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=20240110220124.452746-3-john.fastabend@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=bpf@vger.kernel.org \
    --cc=eadavis@qq.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).