Skip to content

[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Update kernel base to 6.6.138#1673

Merged
opsiff merged 2 commits intodeepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.138
May 8, 2026
Merged

[Deepin-Kernel-SIG] [linux 6.6-y] [Upstream] Update kernel base to 6.6.138#1673
opsiff merged 2 commits intodeepin-community:linux-6.6.yfrom
opsiff:linux-stable-update-6.6.138

Conversation

@opsiff
Copy link
Copy Markdown
Member

@opsiff opsiff commented May 8, 2026

Update kernel base to 6.6.138.

git log --oneline v6.6.137..v6.6.138 |wc
2 13 96

Summary by Sourcery

Update the kernel base to 6.6.138 and adjust IPv4/IPv6 ESP and output handling for shared SKB fragments.

Bug Fixes:

  • Prevent ESP IPv4 and IPv6 input paths from treating SKBs with shared fragments as non-fragmented payloads.

Enhancements:

  • Mark IPv4 and IPv6 output SKBs that use linearized copy as having shared fragments unless explicitly disabled by MSG_NO_SHARED_FRAGS.
  • Bump kernel sublevel from 6.6.137 to 6.6.138.

HexRabbit and others added 2 commits May 8, 2026 15:34
commit f4c50a4034e62ab75f1d5cdd191dd5f9c77fdff4 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 50ed1e7873100f77abad20fd31c51029bc49cd03)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3b9f64db049687c0d38b4b3ef2f297f0642179af)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 8, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Bumps the kernel base from 6.6.137 to 6.6.138 and backports the associated networking fixes to correctly mark and handle shared skb frags in IPv4/IPv6 output and ESP input paths.

Sequence diagram for IPv4/IPv6 append data with shared skb frags

sequenceDiagram
    participant App as Application
    participant Sock as sock
    participant IP4 as __ip_append_data
    participant IP6 as __ip6_append_data
    participant SKB as sk_buff
    participant Info as skb_shared_info

    App->>Sock: sendmsg(data, flags)
    Sock->>IP4: __ip_append_data(sk, data, flags, skb)
    IP4->>SKB: allocate_or_get_skb()
    SKB-->>IP4: skb
    IP4->>IP4: copy = skb_zerocopy_iter_stream()
    alt copy_succeeds_ipv4
        IP4->>Info: skb_shinfo(skb)
        alt allow_shared_frags
            IP4->>Info: set flags |= SKBFL_SHARED_FRAG
        else disallow_shared_frags
            IP4->>IP4: flags has MSG_NO_SHARED_FRAGS
            IP4->>Info: flags unchanged
        end
        IP4->>IP4: wmem_alloc_delta += copy
    end

    App->>Sock: sendmsg_v6(data, flags)
    Sock->>IP6: __ip6_append_data(sk, data, flags, skb)
    IP6->>SKB: allocate_or_get_skb()
    SKB-->>IP6: skb
    IP6->>IP6: copy = skb_zerocopy_iter_stream()
    alt copy_succeeds_ipv6
        IP6->>Info: skb_shinfo(skb)
        alt allow_shared_frags_v6
            IP6->>Info: set flags |= SKBFL_SHARED_FRAG
        else disallow_shared_frags_v6
            IP6->>IP6: flags has MSG_NO_SHARED_FRAGS
            IP6->>Info: flags unchanged
        end
        IP6->>IP6: wmem_alloc_delta += copy
    end
Loading

Sequence diagram for ESP input handling of shared skb frags

sequenceDiagram
    participant NetDev as net_device
    participant Stack as IP_stack
    participant ESP4 as esp_input
    participant ESP6 as esp6_input
    participant SKB as sk_buff
    participant Info as skb_shared_info

    NetDev-->>Stack: receive IPv4 packet
    Stack->>ESP4: esp_input(x, skb)
    ESP4->>Info: skb_shinfo(skb)
    alt cloned_skb
        ESP4->>ESP4: nfrags = 1
        ESP4->>ESP4: goto skip_cow
    else non_cloned_skb
        ESP4->>ESP4: check !skb_has_frag_list(skb) && !skb_has_shared_frag(skb)
        alt no_frag_list_and_not_shared
            ESP4->>ESP4: nfrags = Info.nr_frags + 1
        else has_frag_list_or_shared
            ESP4->>ESP4: follow existing COW path
        end
    end

    NetDev-->>Stack: receive IPv6 packet
    Stack->>ESP6: esp6_input(x, skb)
    ESP6->>Info: skb_shinfo(skb)
    alt cloned_skb_v6
        ESP6->>ESP6: nfrags = 1
        ESP6->>ESP6: goto skip_cow
    else non_cloned_skb_v6
        ESP6->>ESP6: check !skb_has_frag_list(skb) && !skb_has_shared_frag(skb)
        alt no_frag_list_and_not_shared_v6
            ESP6->>ESP6: nfrags = Info.nr_frags + 1
        else has_frag_list_or_shared_v6
            ESP6->>ESP6: follow existing COW path
        end
    end
Loading

Class diagram for sk_buff and skb_shared_info with shared frag flag handling

classDiagram
    class sk_buff {
        +unsigned int len
        +unsigned int data_len
        +unsigned int truesize
        +unsigned int queue_mapping
        +unsigned short protocol
        +unsigned int priority
        +void* head
        +unsigned char* data
        +unsigned char* tail
        +unsigned char* end
        +sk_buff* frag_list
        +skb_shared_info* shinfo
        +bool cloned
        +bool nohdr
        +bool destructor
    }

    class skb_shared_info {
        +unsigned short nr_frags
        +unsigned short gso_size
        +unsigned short gso_segs
        +unsigned int gso_type
        +unsigned int ip6_frag_id
        +unsigned int flags
        +const skb_frag_t frags[]
        +bool has_shared_frag()
        +bool has_frag_list()
    }

    class ip_output {
        +int __ip_append_data(sock* sk, void* data, int flags, sk_buff* skb)
    }

    class ip6_output {
        +int __ip6_append_data(sock* sk, void* data, int flags, sk_buff* skb)
    }

    class esp4 {
        +int esp_input(xfrm_state* x, sk_buff* skb)
    }

    class esp6 {
        +int esp6_input(xfrm_state* x, sk_buff* skb)
    }

    class skb_flags_constants {
        <<enumeration>>
        +unsigned int SKBFL_SHARED_FRAG
        +int MSG_NO_SHARED_FRAGS
    }

    sk_buff --> skb_shared_info : has
    sk_buff --> sk_buff : frag_list
    ip_output --> sk_buff : manipulates
    ip_output --> skb_shared_info : sets SKBFL_SHARED_FRAG
    ip6_output --> sk_buff : manipulates
    ip6_output --> skb_shared_info : sets SKBFL_SHARED_FRAG
    esp4 --> sk_buff : reads
    esp4 --> skb_shared_info : reads nr_frags and flags
    esp6 --> sk_buff : reads
    esp6 --> skb_shared_info : reads nr_frags and flags
    skb_shared_info --> skb_flags_constants : uses
    ip_output --> skb_flags_constants : uses
    ip6_output --> skb_flags_constants : uses
Loading

File-Level Changes

Change Details Files
Update kernel version metadata to 6.6.138.
  • Increment kernel SUBLEVEL from 137 to 138 in the main Makefile to reflect the new base version.
Makefile
Mark linear data copied into skb as using shared frags unless explicitly disabled, for both IPv4 and IPv6 output paths.
  • After copying data into the skb head in __ip_append_data, set SKBFL_SHARED_FRAG in skb_shinfo(skb)->flags when MSG_NO_SHARED_FRAGS is not set.
  • Apply the same SKBFL_SHARED_FRAG flag-setting logic in __ip6_append_data for IPv6 output.
net/ipv4/ip_output.c
net/ipv6/ip6_output.c
Avoid CoW handling on skb that already uses shared frags in ESP input processing.
  • In esp_input, gate the non-frag_list CoW path on both !skb_has_frag_list(skb) and !skb_has_shared_frag(skb), ensuring shared frag skbs are not treated as simple frag arrays.
  • Mirror the same condition change in esp6_input for IPv6 ESP processing.
net/ipv4/esp4.c
net/ipv6/esp6.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new skb_has_shared_frag() checks in both esp_input and esp6_input duplicate the same conditional pattern as the frag list check; consider factoring this into a small helper or macro to keep the IPv4/IPv6 ESP paths in lockstep and reduce chances of future divergence.
  • In __ip_append_data and __ip6_append_data, it may be helpful to add a short comment near the SKBFL_SHARED_FRAG flag assignment to explain the interaction with MSG_NO_SHARED_FRAGS and why the linearized copy path implies shared fragments, to aid future maintainers debugging SKB lifetime issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `skb_has_shared_frag()` checks in both `esp_input` and `esp6_input` duplicate the same conditional pattern as the frag list check; consider factoring this into a small helper or macro to keep the IPv4/IPv6 ESP paths in lockstep and reduce chances of future divergence.
- In `__ip_append_data` and `__ip6_append_data`, it may be helpful to add a short comment near the `SKBFL_SHARED_FRAG` flag assignment to explain the interaction with `MSG_NO_SHARED_FRAGS` and why the linearized copy path implies shared fragments, to aid future maintainers debugging SKB lifetime issues.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@opsiff opsiff merged commit 0430cbf into deepin-community:linux-6.6.y May 8, 2026
14 of 16 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Deepin kernel base to Linux 6.6.138, incorporating upstream networking fixes related to ESP (IPv4/IPv6) input handling and marking SKBs with potentially shared fragments during output construction.

Changes:

  • Bump kernel sublevel from 6.6.137 → 6.6.138.
  • Mark SKBs built via MSG_SPLICE_PAGES as SKBFL_SHARED_FRAG unless MSG_NO_SHARED_FRAGS is set (IPv4/IPv6 output paths).
  • Prevent ESP IPv4/IPv6 input from taking the “no COW needed” fast path when the skb has SKBFL_SHARED_FRAG.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
net/ipv6/ip6_output.c Marks spliced-page output SKBs as having shared frags unless explicitly disabled.
net/ipv6/esp6.c Avoids fast-path fragment assumptions when skb contains shared frags.
net/ipv4/ip_output.c Marks spliced-page output SKBs as having shared frags unless explicitly disabled.
net/ipv4/esp4.c Avoids fast-path fragment assumptions when skb contains shared frags.
Makefile Bumps kernel SUBLEVEL to 138.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants