Skip to content

[ciqlts8_6] xfrm: esp: avoid in-place decrypt on shared skb frags#1201

Merged
roxanan1996 merged 1 commit into
ciqlts8_6from
{rnicolescu}_ciqlts8_6
May 8, 2026
Merged

[ciqlts8_6] xfrm: esp: avoid in-place decrypt on shared skb frags#1201
roxanan1996 merged 1 commit into
ciqlts8_6from
{rnicolescu}_ciqlts8_6

Conversation

@ciq-kernel-automation

@ciq-kernel-automation ciq-kernel-automation Bot commented May 8, 2026

Copy link
Copy Markdown

Local test

[rnicolescu@localhost kernel-src-tree]$ git log -1 --format=%h
e4cc9ad7250d
[rnicolescu@localhost kernel-src-tree]$ uname -r
4.18.0-rnicolescu_ciqlts8_6-e4cc9ad7250d+
[rnicolescu@localhost kernel-src-tree]$ cd ..
 && cd dirtyfrag && gcc -O0 -Wall -o exp exp.c -lutil && ./exp4bel/dirtyfrag.git
Cloning into 'dirtyfrag'...
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 46 (delta 5), reused 4 (delta 4), pack-reused 34 (from 1)
Receiving objects: 100% (46/46), 5.83 MiB | 3.15 MiB/s, done.
Resolving deltas: 100% (15/15), done.
[  244.608401] alg: No test for authencesn(hmac(sha256),cbc(aes)) (authencesn(hmac(sha256-ni),cbc-aes-aesni))
[  244.616144] alg: No test for echainiv(authencesn(hmac(sha256),cbc(aes))) (echainiv(authencesn(hmac(sha256-ni),cbc-aes-aesni)))
dirtyfrag: failed (rc=1)
[rnicolescu@localhost dirtyfrag]$ lsmod | grep rxrcp
[rnicolescu@localhost dirtyfrag]$ cat /etc/modprobe.d/
cat: /etc/modprobe.d/: Is a directory
[rnicolescu@localhost dirtyfrag]$ ls /etc/modprobe.d/
lockd.conf  tuned.conf
[rnicolescu@localhost dirtyfrag]$ ls /etc/modprobe.d/
[rnicolescu@localhost dirtyfrag]$ modprove rxrpc
-bash: modprove: command not found
[rnicolescu@localhost dirtyfrag]$ modprobe rxrpc
modprobe: FATAL: Module rxrpc not found in directory /lib/modules/4.18.0-rnicolescu_ciqlts8_6-e4cc9ad7250d+
[rnicolescu@localhost dirtyfrag]$ id
uid=1000(rnicolescu) gid=1000(rnicolescu) groups=1000(rnicolescu) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Summary

This PR has been automatically created after successful completion of all CI stages.

Commit Message(s)

xfrm: esp: avoid in-place decrypt on shared skb frags

unpub-cve DIRTY-FRAG
commit-author Kuan-Ting Chen <h3xrabbit@gmail.com>
commit f4c50a4034e62ab75f1d5cdd191dd5f9c77fdff4
upstream-diff |
	While this kernel lacks MSG_SPLICE_PAGES, it still has udp_sendpage().
	Upstream didn't patch udp_sendpage() because sendpage was removed
	entirely in favor of MSG_SPLICE_PAGES. In this kernel, splice() can
	still attach a page cache page to an IPv4 datagram via sendpage.
	Therefore, udp_sendpage() must be patched instead. And there is no
	patch for IPv6 datagrams because it isn't affected; there's no
	sendpage callback for IPv6 UDP.
	Due to missing 06b4feb37e64 ("net: group skb_shinfo zerocopy related bits together.")
	SKBFL_SHARED_FRAG was replaced with SKBTX_SHARED_FRAG.
	Also replaced flags with tx_flags.

Test Results

✅ Build Stage

Architecture Build Time Total Time
x86_64 23m 55s 24m 54s
aarch64 12m 33s 13m 15s

✅ Boot Verification

✅ Kernel Selftests

Architecture Passed Failed Compared Against Status
x86_64 108 31 ciqlts8_6 ✅ No regressions
aarch64 67 20 ciqlts8_6 ✅ No regressions

✅ LTP Results

Architecture Passed Failed Compared Against Status
x86_64 1443 13 ciqlts8_6 ✅ No regressions
aarch64 1426 13 ciqlts8_6 ✅ No regressions

aarch64 newly passing:

  • starvation (FAIL -> PASS)

🤖 This PR was automatically generated by GitHub Actions
Run ID: 25546085599

unpub-cve DIRTY-FRAG
commit-author Kuan-Ting Chen <h3xrabbit@gmail.com>
commit f4c50a4
upstream-diff |
	While this kernel lacks MSG_SPLICE_PAGES, it still has udp_sendpage().
	Upstream didn't patch udp_sendpage() because sendpage was removed
	entirely in favor of MSG_SPLICE_PAGES. In this kernel, splice() can
	still attach a page cache page to an IPv4 datagram via sendpage.
	Therefore, udp_sendpage() must be patched instead. And there is no
	patch for IPv6 datagrams because it isn't affected; there's no
	sendpage callback for IPv6 UDP.
	Due to missing 06b4feb ("net: group skb_shinfo zerocopy related bits together.")
	SKBFL_SHARED_FRAG was replaced with SKBTX_SHARED_FRAG.
	Also replaced flags with tx_flags.

MSG_SPLICE_PAGES can attach pages from a pipe directly to an skb. TCP
marks such skbs with SKBFL_SHARED_FRAG after skb_splice_from_iter(),
so later paths that may modify packet data can first make a private
copy. The IPv4/IPv6 datagram append paths did not set this flag when
splicing pages into UDP skbs.

That leaves an ESP-in-UDP packet made from shared pipe pages looking
like an ordinary uncloned nonlinear skb. ESP input then takes the no-COW
fast path for uncloned skbs without a frag_list and decrypts in place
over data that is not owned privately by the skb.

Mark IPv4/IPv6 datagram splice frags with SKBFL_SHARED_FRAG, matching
TCP. Also make ESP input fall back to skb_cow_data() when the flag is
present, so ESP does not decrypt externally backed frags in place.
Private nonlinear skb frags still use the existing fast path.

This intentionally does not change ESP output. In esp_output_head(),
the path that appends the ESP trailer to existing skb tailroom without
calling skb_cow_data() is not reachable for nonlinear skbs:
skb_tailroom() returns zero when skb->data_len is nonzero, while ESP
tailen is positive. Thus ESP output will either use the separate
destination-frag path or fall back to skb_cow_data().

Fixes: cac2661 ("esp4: Avoid skb_cow_data whenever possible")
Fixes: 03e2a30 ("esp6: Avoid skb_cow_data whenever possible")
Fixes: 7da0dde ("ip, udp: Support MSG_SPLICE_PAGES")
Fixes: 6d8192b ("ip6, udp6: Support MSG_SPLICE_PAGES")
	Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
	Reported-by: Kuan-Ting Chen <h3xrabbit@gmail.com>
	Tested-by: Hyunwoo Kim <imv4bel@gmail.com>
	Cc: stable@vger.kernel.org
	Signed-off-by: Kuan-Ting Chen <h3xrabbit@gmail.com>
	Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit f4c50a4)
	Signed-off-by: Shreeya Patel <spatel@ciq.com>
	Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
@ciq-kernel-automation ciq-kernel-automation Bot added the created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI) label May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/25556698207

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🔍 Upstream Linux Kernel Commit Check

  • ⚠️ PR commit e4cc9ad7250d (xfrm: esp: avoid in-place decrypt on shared skb frags) does not reference a CVE but
    upstream commit f4c50a4034e6 is associated with CVE-2026-43284

This is an automated message from the kernel commit checker workflow.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🔍 Interdiff Analysis

  • ⚠️ PR commit e4cc9ad7250d (xfrm: esp: avoid in-place decrypt on shared skb frags) → upstream f4c50a4034e6
    Differences found:
================================================================================
*    DELTA DIFFERENCES - code changes that differ between the patches          *
================================================================================

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1333,9 +1333,6 @@
 			goto error;
 		}
 
-		if (!(flags & MSG_NO_SHARED_FRAGS))
-			skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
-
 		if (skb->ip_summed == CHECKSUM_NONE) {
 			__wsum csum;
 			csum = csum_page(page, offset, len);

################################################################################
!    REJECTED PATCH2 HUNKS - could not be compared; manual review needed       !
################################################################################

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1233,6 +1233,8 @@
 			if (err < 0)
 				goto error;
 			copy = err;
+			if (!(flags & MSG_NO_SHARED_FRAGS))
+				skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
 			wmem_alloc_delta += copy;
 		} else if (!zc) {
 			int i = skb_shinfo(skb)->nr_frags;

================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1230,6 +1230,6 @@
-			goto error;
-		}
-
-		if (skb->ip_summed == CHECKSUM_NONE) {
-			__wsum csum;
-			csum = csum_page(page, offset, len);
+			if (err < 0)
+				goto error;
+			copy = err;
+			wmem_alloc_delta += copy;
+		} else if (!zc) {
+			int i = skb_shinfo(skb)->nr_frags;

================================================================================
*    ONLY IN PATCH2 - files not modified by patch1                             *
================================================================================

--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -915,7 +915,8 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
 			nfrags = 1;
 
 			goto skip_cow;
-		} else if (!skb_has_frag_list(skb)) {
+		} else if (!skb_has_frag_list(skb) &&
+			   !skb_has_shared_frag(skb)) {
 			nfrags = skb_shinfo(skb)->nr_frags;
 			nfrags++;
 
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1794,6 +1794,8 @@ alloc_new_skb:
 			if (err < 0)
 				goto error;
 			copy = err;
+			if (!(flags & MSG_NO_SHARED_FRAGS))
+				skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
 			wmem_alloc_delta += copy;
 		} else if (!zc) {
 			int i = skb_shinfo(skb)->nr_frags;

This is an automated interdiff check for backported commits.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/25556698207

@roxanan1996 roxanan1996 merged commit 5c9ed6a into ciqlts8_6 May 8, 2026
5 checks passed
@roxanan1996 roxanan1996 deleted the {rnicolescu}_ciqlts8_6 branch June 8, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI)

Development

Successfully merging this pull request may close these issues.

4 participants