aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/tls.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-09-17 00:28:14 +0000
committerPaolo Abeni <[email protected]>2025-09-18 10:43:54 +0000
commit4c05c7ed880fb58790731fb53571af67b7632d87 (patch)
tree6bf726e278e1d45972c2091b41a5a68dcc4d884f /tools/testing/selftests/net/tls.c
parenttls: make sure to abort the stream if headers are bogus (diff)
downloadkernel-4c05c7ed880fb58790731fb53571af67b7632d87.tar.gz
kernel-4c05c7ed880fb58790731fb53571af67b7632d87.zip
selftests: tls: test skb copy under mem pressure and OOB
Add a test which triggers mem pressure via OOB writes. Reviewed-by: Sabrina Dubroca <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'tools/testing/selftests/net/tls.c')
-rw-r--r--tools/testing/selftests/net/tls.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 0f5640d8dc7f..dd093f9df6f1 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -2770,6 +2770,22 @@ TEST_F(tls_err, poll_partial_rec_async)
}
}
+/* Use OOB+large send to trigger copy mode due to memory pressure.
+ * OOB causes a short read.
+ */
+TEST_F(tls_err, oob_pressure)
+{
+ char buf[1<<16];
+ int i;
+
+ memrnd(buf, sizeof(buf));
+
+ EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5);
+ EXPECT_EQ(send(self->fd2, buf, sizeof(buf), 0), sizeof(buf));
+ for (i = 0; i < 64; i++)
+ EXPECT_EQ(send(self->fd2, buf, 5, MSG_OOB), 5);
+}
+
TEST(non_established) {
struct tls12_crypto_info_aes_gcm_256 tls12;
struct sockaddr_in addr;