diff options
author | John Fastabend <john.fastabend@gmail.com> | 2024-01-12 16:32:58 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-01-14 12:17:14 +0000 |
commit | 034ea1305e659ddae44c19ba8449166fec318e2d (patch) | |
tree | 67c140bdf25c646b83916f7341b2363127171628 /tools/testing | |
parent | dc9dfc8dc629e42f2234e3327b75324ffc752bc9 (diff) | |
download | linux-034ea1305e659ddae44c19ba8449166fec318e2d.tar.gz linux-034ea1305e659ddae44c19ba8449166fec318e2d.tar.bz2 linux-034ea1305e659ddae44c19ba8449166fec318e2d.zip |
net: tls, add test to capture error on large splice
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>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/net/tls.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c index 464853a7f982..7799e042a971 100644 --- a/tools/testing/selftests/net/tls.c +++ b/tools/testing/selftests/net/tls.c @@ -707,6 +707,20 @@ TEST_F(tls, splice_from_pipe) EXPECT_EQ(memcmp(mem_send, mem_recv, send_len), 0); } +TEST_F(tls, splice_more) +{ + unsigned int f = SPLICE_F_NONBLOCK | SPLICE_F_MORE | SPLICE_F_GIFT; + 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, f), 1); +} + TEST_F(tls, splice_from_pipe2) { int send_len = 16000; |