Skip to content

[Deepin-Kernel-SIG] [linux 6.6.y] [KABI] apply kabi fixes for 6.6.160-6.6.161 - #2267

Merged
opsiff merged 6 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-11-16-kabi-2
Nov 17, 2026
Merged

opsiff merged 6 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-11-16-kabi-2

Conversation

@opsiff

@opsiff opsiff commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary by Sourcery

Apply Deepin KABI compatibility fixes for the 6.6.160–6.6.161 kernel updates.

Enhancements:

  • Preserve kernel ABI compatibility across updated 6.6.y structures by relocating changed fields into Deepin KABI extensions and replacements.
  • Maintain futex memory-management structure compatibility across 32-bit and 64-bit configurations while retaining the futex unique identifier.

@sourcery-ai

sourcery-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Keep the futex identifier in reserved mm_struct storage without shifting the structure layout, with separate storage for 32-bit and 64-bit builds.

  • include/linux/mm_types.h L926 (removed lines), L1060-1079

Preserve io_uring structure layouts while retaining the deferred poll-wake fields and relocated poll_refs counter.

  • include/linux/io_uring_types.h L7-603 (6 small edits)

Move needs_stable_writes to a KABI extension at the end of dm_target to avoid changing existing field layout.

  • include/linux/device-mapper.h L15, L360 (removed lines), L400-402

Place perf_mlock at the end of user_struct through a KABI extension to preserve existing member offsets.

  • include/linux/sched/user.h L10, L32 (removed lines), L38-40

Hide unicode_map's RCU head in a KABI extension so its existing layout remains unchanged.

  • include/linux/unicode.h L7, L55

Implementation

Cast the reserved futex identifier storage to atomic64_t at initialization and lookup sites so existing futex ID handling works with the new mm_struct layout.

  • kernel/fork.c L1350
  • kernel/futex/core.c L351-352

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="include/linux/mm_types.h" line_range="1061" />
<code_context>
 	} __randomize_layout;

+#ifdef CONFIG_FUTEX
+	DEEPIN_KABI_USE(1, 2, atomic64_t futex_unique_id)
+	DEEPIN_KABI_RESERVE(3)
+#else
</code_context>
<issue_to_address>
**32-bit futex builds fail**

When a 32-bit kernel is built with KABI reserves enabled and size/alignment checks active, `DEEPIN_KABI_USE` fails its size/alignment assertion because `atomic64_t` is larger or more aligned than the reserved slots. Without the checks, the field overruns its slot and shifts the remaining reserved layout, so the kernel build or ABI layout fails.

Reserve storage with sufficient size and alignment for `atomic64_t`, or avoid this replacement on affected 32-bit architectures.
</issue_to_address>

### Comment 2
<location path="include/linux/io_uring_types.h" line_range="367-368" />
<code_context>
 	/* deferred ->poll_wq wake up for local task_work */
-	struct rcu_head			poll_wq_rcu;
-	atomic_t			poll_wq_rcu_pending;
+	DEEPIN_KABI_EXTEND(struct rcu_head poll_wq_rcu)
+	DEEPIN_KABI_EXTEND(atomic_t poll_wq_rcu_pending)
 	struct list_head		defer_list;
 	unsigned			sq_thread_idle;
</code_context>
<issue_to_address>
**Older modules access shifted fields**

When an out-of-tree module built against the baseline layout accesses a later member of either struct, `DEEPIN_KABI_EXTEND` inserts runtime fields in the middle of the structs, and relocating `io_kiocb.poll_refs` also shifts later members; genksyms hides the additions, but the runtime offsets change, so the module reads or writes the wrong state and io_uring can fail or be corrupted.

Place the added fields at the ends of their structs, preserving the offsets of existing members.

Also at `include/linux/io_uring_types.h:594`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread include/linux/mm_types.h Resolved
Comment thread include/linux/io_uring_types.h Outdated
Comment on lines +367 to +368
DEEPIN_KABI_EXTEND(struct rcu_head poll_wq_rcu)
DEEPIN_KABI_EXTEND(atomic_t poll_wq_rcu_pending)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Older modules access shifted fields

When an out-of-tree module built against the baseline layout accesses a later member of either struct, DEEPIN_KABI_EXTEND inserts runtime fields in the middle of the structs, and relocating io_kiocb.poll_refs also shifts later members; genksyms hides the additions, but the runtime offsets change, so the module reads or writes the wrong state and io_uring can fail or be corrupted.

Place the added fields at the ends of their structs, preserving the offsets of existing members.

Also at include/linux/io_uring_types.h:594.

Prompt for AI agents
In `include/linux/io_uring_types.h` at lines 367-368:

**Older modules access shifted fields**

When an out-of-tree module built against the baseline layout accesses a later member of either struct, `DEEPIN_KABI_EXTEND` inserts runtime fields in the middle of the structs, and relocating `io_kiocb.poll_refs` also shifts later members; genksyms hides the additions, but the runtime offsets change, so the module reads or writes the wrong state and io_uring can fail or be corrupted.

Place the added fields at the ends of their structs, preserving the offsets of existing members.

Also at `include/linux/io_uring_types.h:594`.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical KABI issues remain: io_uring extensions shift existing member offsets, and the mm_types change fails the alignment assertion on 32-bit x86 with the relevant configuration enabled.

3 open issues
What changed in this PR

This PR applies Deepin kernel ABI compatibility adjustments for Linux 6.6.160–6.6.161 across several core structures.

Changes:

  • Adds KABI extension and replacement annotations to recently changed fields.
  • Relocates user-tracking and device-mapper fields to structure tails.
  • Moves the memory-management futex identifier into reserved KABI slots.
File Description
include/​linux/​unicode.h Marks the Unicode map’s RCU field as a KABI extension.
include/​linux/​sched/​user.h Moves perf_mlock to the structure tail and annotates it.
include/​linux/​mm_types.h Places futex_unique_id in two reserved slots.
include/​linux/​io_uring_types.h Adds KABI annotations for polling and cancellation fields.
include/​linux/​device-mapper.h Moves needs_stable_writes to the structure tail and annotates it.

Review effort: Balanced

Comment thread include/linux/io_uring_types.h Resolved
Comment thread include/linux/io_uring_types.h Resolved
Comment thread include/linux/mm_types.h Resolved
@opsiff
opsiff force-pushed the linux-6.6.y-2026-11-16-kabi-2 branch from 6d364e7 to 5a317cd Compare November 16, 2026 14:18
@dongert
dongert requested a balanced review from Copilot November 16, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

With CONFIG_FUTEX=y, the change shifts cpu_bitmap eight bytes beyond its frozen 64-bit ABI offset, causing prebuilt modules using mm_cpumask() to read or overwrite the futex ID.

1 open issue
3 resolved since last review

Review effort: Balanced

Comment thread include/linux/mm_types.h Resolved
@opsiff
opsiff force-pushed the linux-6.6.y-2026-11-16-kabi-2 branch from 5a317cd to 430f5b4 Compare November 16, 2026 16:38
@dongert
dongert requested a balanced review from Copilot November 16, 2026 16:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The backing storage’s eight-byte u64 alignment violates the KABI alignment assertion on 32-bit ARM EABI when futex support, reserves, and alignment checks are enabled.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread include/linux/mm_types.h Resolved
deepin inclusion
category: kabi

Commit 1addada ("futex: Fix mm reuse handling for FUT_OFF_MMSHARED")
inserts atomic64_t futex_unique_id ahead of the hiwater counters in the
middle of struct mm_struct, shifting the offsets of every following
member and changing the genksyms checksums of exported symbols whose
type graph reaches the struct.

Place the counter in the trailing reserve slots with DEEPIN_KABI_USE()
so genksyms keeps seeing the five reserve placeholders.  The flexible
cpu_bitmap array must stay at its baseline offset because prebuilt
modules inline mm_cpumask() and read the offset directly, which
symbol checksums cannot see; consuming existing slot storage instead
of appending after it preserves that offset.

On 64-bit a single eight-byte, eight-byte-aligned reserve word holds
the atomic64_t as-is.  On 32-bit the reserve words are four bytes each
and only four-byte aligned: u64 is eight-byte aligned under the ARM
EABI, so two u32 words back the counter instead, which passes the
DEEPIN_KABI_SIZE_ALIGN_CHECKS assertions on every 32-bit ABI.  The
anonymous struct holding atomic64_t pinned_vm keeps this storage at an
eight-byte-aligned offset in practice, so the use-site casts to
atomic64_t stay safe.

Fixes: 1addada ("futex: Fix mm reuse handling for FUT_OFF_MMSHARED")
Change-Id: I5e8d625425a6b10a0a9733f0c70339939bfa0bfa
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
deepin inclusion
category: kabi

Commit d1c994e ("dm-integrity: require stable writes for internal
hash modes") inserts the needs_stable_writes bit into the middle of the
bitfield cluster at the end of struct dm_target, changing the storage
unit layout and the genksyms checksums of exported symbols whose type
graph reaches the struct.

Move the bit to the tail of the struct with DEEPIN_KABI_EXTEND() so
genksyms keeps seeing the original layout.  struct dm_target is
allocated only by the device-mapper core with sizeof() and is only
passed to target modules by pointer, so appending the bit is safe and
the runtime field remains accessible to both the core and the
targets.

Fixes: d1c994e ("dm-integrity: require stable writes for internal hash modes")
Change-Id: I5e1f5b4096514a5aff5749526b9b484f74f32cd3
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
deepin inclusion
category: kabi

Commit 89b23df ("unicode: free the map after a grace period")
appends struct rcu_head rcu to struct unicode_map, growing the
structure and changing the genksyms checksums of exported symbols
whose type graph reaches the struct.

Add the rcu_head with DEEPIN_KABI_EXTEND() instead.  struct unicode_map
is allocated only by the unicode core with sizeof() and is handed to
its users by pointer, so the hidden tail extension is safe and
kfree_rcu() keeps working unchanged.

Fixes: 89b23df ("unicode: free the map after a grace period")
Change-Id: I28f60e0c6b99d5f8d4a500cdf466e1b08ea2e76f
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
deepin inclusion
category: kabi

Commit 6bf27f8 ("perf: Track the perf mlock gift separately")
inserts atomic_long_t perf_mlock ahead of the ratelimit state in the
middle of struct user_struct, shifting the offsets of the following
members and changing the genksyms checksums of exported symbols whose
type graph reaches the struct.

Move the counter to the tail of the struct with DEEPIN_KABI_EXTEND()
so genksyms keeps seeing the original layout.  struct user_struct is
allocated only by the core uid cache with sizeof() and is only ever
referenced through pointers, so the hidden tail extension is safe and
the mlock accounting keeps working unchanged.

Fixes: 6bf27f8 ("perf: Track the perf mlock gift separately")
Change-Id: Iafc77c06212e33244670a3b1e4502874a900387c
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
deepin inclusion
category: kabi

Commit 7ecc426 ("io_uring/cancel: don't default to setting
req->work.cancel_seq") replaces the poll_refs counter right after
atomic_t refs with bool cancel_seq_set and re-adds poll_refs later in
the struct, before link, changing the member layout seen by genksyms
and the checksums of exported symbols whose type graph reaches struct
io_kiocb.

Use DEEPIN_KABI_REPLACE() at the original poll_refs position so
genksyms keeps seeing the baseline layout while the runtime structure
keeps cancel_seq_set, and hide the relocated poll_refs behind
DEEPIN_KABI_EXTEND() appended after big_cqe, keeping every existing
member at its baseline offset as the extension contract requires.  The
runtime structure is then laid out exactly as the macro contract
allows, all in-tree users keep working unchanged and the macro adds
compile-time size and alignment checks between the two views.

Fixes: 7ecc426 ("io_uring/cancel: don't default to setting req->work.cancel_seq")
Change-Id: Ic13cd5433bc312f0118f8c82e6d9345f73b5f1a7
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
deepin inclusion
category: kabi

Commit cc8e033 ("io_uring: wake ring pollers for local task_work")
adds struct rcu_head poll_wq_rcu and atomic_t poll_wq_rcu_pending to
the middle of struct io_ring_ctx, shifting the offsets of the
following members and changing the genksyms checksums of exported
symbols whose type graph reaches the struct.

Hide both fields behind DEEPIN_KABI_EXTEND() at the tail of the struct,
after sqe_pages, so genksyms keeps seeing the baseline layout while the
runtime structure retains the deferred poll-wq wake state.  struct
io_ring_ctx is allocated only by the io_uring core with sizeof() and is
never embedded, so the hidden tail extension cannot break any existing
user, and the wake logic keeps working unchanged.

Fixes: cc8e033 ("io_uring: wake ring pollers for local task_work")
Change-Id: I0e13ba4ec139094b93313c4785ba5dfd814371f1
Signed-off-by: shaoyang <shaoyang@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@opsiff
opsiff force-pushed the linux-6.6.y-2026-11-16-kabi-2 branch from 430f5b4 to 7beacf8 Compare November 16, 2026 16:52
@dongert
dongert requested a balanced review from Copilot November 16, 2026 16:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

KABI preservation requires maintainer validation against frozen symbol CRC and structure-layout baselines, but baseline comparisons and cross-architecture build artifacts are missing, particularly for 32-bit alignment.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@opsiff
opsiff merged commit 2ff794d into deepin-community:linux-6.6.y Nov 17, 2026
13 checks passed
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.

3 participants