sockets/xfrm02: Add ESP-in-TCP page cache corruption test
PATCH v3 1/1 sockets/xfrm02: Add ESP-in-TCP page cache corruption test
From: Andrea Cervesato <[email protected]>
Verify that ESP-in-TCP (espintcp) does not corrupt the page cache when file data is spliced into a TCP socket. When MSG_SPLICE_PAGES references page cache pages directly in the skb and the receiving socket has espintcp ULP enabled, the kernel's ESP handler may decrypt the payload in-place on those pages, corrupting the cached file contents.
The test sets up an ESP-in-TCP xfrm state on IPv6 loopback, writes known data to a file, creates a TCP connection where the receiver enables espintcp ULP, splices the file data into the TCP socket as part of a crafted ESP-in-TCP frame, and then verifies whether the page cache was corrupted.
Reproducer based on:
https://github.com/v12-security/pocs/tree/main/fragnesia
---
Changes in v3:
- move tst_reap_children after SAFE_CLOSE()
- add cve number
- fadvise() on file
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- use tst_cmd()
- evict pages before sending prefix
- remove checkpoints
- add usleep() to trigger the bug
- use tst_reap_children()
- Link to v1: https://lore.kernel.org/r/[email protected]
--- runtest/cve | 1 + testcases/network/sockets/.gitignore | 1 + testcases/network/sockets/xfrm02.c | 231 +++++++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+)
runtest/cve +1 -0
@@ -95,3 +95,4 @@ cve-2025-38236 cve-2025-38236 cve-2025-21756 cve-2025-21756 cve-2026-31431 af_alg08 cve-2026-43284 xfrm01 +cve-2026-46300 xfrm02
testcases/network/sockets/.gitignore +1 -0
@@ -1 +1,2 @@ /xfrm01 +/xfrm02
testcases/network/sockets/xfrm02.c new file +231 -0
231 lines not on this page · raw message
---
base-commit: e1fc50957c98ae4c27064756e063de0e7136cde3
change-id: 20260513-fragnesia-9588d855becf
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Pushed, thanks.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Andrea,
testcases/network/sockets/xfrm02.c line 166
Quoted 4 lines · Andrea Cervesato
sockets/xfrm02: Add ESP-in-TCP page cache corruption test
testcases/network/sockets/xfrm02.c new file +2
-0+/* Let the espintcp strparser process buffered ESP data */ +usleep (30000 );
Sleep-based synchronization is not allowed. Use an event-based mechanism (e.g. poll the accepted socket for readability) instead of a fixed sleep.
[...]
testcases/network/sockets/xfrm02.c line 149
Quoted 1 line
testcases/network/sockets/xfrm02.c new file +1
-0+splice (pipefd[0 ],NULL , cli_fd,NULL ,DATA_SIZE ,0 );
SAFE_SPLICE() exists; use it, or wrap in TEST() if failure on patched kernels is expected. The return value must not be silently discarded.
[...]
Quoted 1 line
+static int
srv_fd= -1;
[...]
Quoted 1 line
(quoted diff) +1
-0+ SAFE_CLOSE(srv_fd);
[...]
testcases/network/sockets/xfrm02.c line 198
Quoted 2 lines
testcases/network/sockets/xfrm02.c new file +2
-0+if (srv_fd !=-1 ) +SAFE_CLOSE (srv_fd);
srv_fd and file_fd are closed inside try_corrupt()/run() but never reset to -1, so cleanup() calls SAFE_CLOSE() on already-closed fds (EBADF). Assign -1 after each SAFE_CLOSE() on these globals.
---
Note:
Our agent completed the review of the patch. The full review can be found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25819929958
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp