selftests: tls: size splice_short pipe by page size
Subsystems (4)
PATCH v2 1/1 selftests: tls: size splice_short pipe by page size
splice_short grows its pipe with (MAX_FRAGS + 1) * 0x1000 so it can queue one short vmsplice() buffer for each fragment before draining the pipe. That assumes 4K pipe buffers.
On 64K-page kernels the request is rounded to 262144 bytes, which provides only four pipe buffers. The fifth one-byte vmsplice() blocks in pipe_wait_writable and the test times out before it reaches the TLS path.
Request enough bytes for the same number of pipe buffers using the runtime page size, and assert that the kernel granted at least that much. If an unprivileged run cannot raise the pipe above the system pipe-max-size limit, skip the test because it cannot exercise the intended path.
---
v2: Remove redundant ASSERT_GE(ret, 0) (Simon Horman).
tools/testing/selftests/net/tls.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/selftests/net/tls.c +7 -1
@@ -997,6 +997,8 @@ TEST_F(tls, splice_short)char sendbuf[0x100 ];char sendchar ='S' ;int pipefds[2 ]; +int pipe_sz; +int ret;int i; sendchar_iov.iov_base = &sendchar;
@@ -1005,7 +1007,11 @@ TEST_F(tls, splice_short)memset (sendbuf,'s' ,sizeof (sendbuf));ASSERT_GE (pipe2 (pipefds,O_NONBLOCK ),0 ); -ASSERT_GE (fcntl (pipefds[0 ],F_SETPIPE_SZ , (MAX_FRAGS +1 ) *0x1000 ),0 ); + pipe_sz = (MAX_FRAGS +1 ) *getpagesize (); + ret =fcntl (pipefds[0 ],F_SETPIPE_SZ , pipe_sz); +if (ret <0 && errno ==EPERM ) +SKIP (return,"insufficient pipe capacity" ); +ASSERT_GE (ret, pipe_sz);for (i =0 ; i <MAX_FRAGS ; i++)ASSERT_GE (vmsplice (pipefds[1 ], &sendchar_iov,1 ,0 ),0 );
base-commit: 47186409c092cd7dd70350999186c700233e854d
Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 24 Jun 2026 06:44:16 -0700 you wrote:
splice_shortgrows its pipe with (MAX_FRAGS+ 1) *0x1000so it can queue one shortvmsplice()buffer for each fragment before draining the pipe. That assumes 4K pipe buffers.On 64K-page kernels the request is rounded to 262144 bytes, which provides only four pipe buffers. The fifth one-byte
vmsplice()blocks inpipe_wait_writableand the test times out before it reaches the TLS path.[...]
Here is the summary with links:
- [net-next,v2] selftests: tls: size splice_short pipe by page size
https://git.kernel.org/netdev/net/c/3e52f56875c6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html