From 04aa41cf8fb098ba69cbd38688bcf0246ae6e5d2 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:52:03 +0800 Subject: [PATCH 1/6] futex: Fix kabi breakage in struct mm_struct deepin inclusion category: kabi Commit 1addada417651 ("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: 1addada417651 ("futex: Fix mm reuse handling for FUT_OFF_MMSHARED") Change-Id: I5e8d625425a6b10a0a9733f0c70339939bfa0bfa Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/mm_types.h | 22 ++++++++++++++++++---- kernel/fork.c | 2 +- kernel/futex/core.c | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 454ffc8e62f60..dc47c64c64f64 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -923,10 +923,6 @@ struct mm_struct { */ int mm_lock_seq; #endif -#ifdef CONFIG_FUTEX - atomic64_t futex_unique_id; -#endif - unsigned long hiwater_rss; /* High-watermark of RSS usage */ unsigned long hiwater_vm; /* High-water virtual memory usage */ @@ -1061,8 +1057,26 @@ struct mm_struct { #endif /* CONFIG_LRU_GEN */ } __randomize_layout; +#ifdef CONFIG_FUTEX +#ifdef CONFIG_64BIT + DEEPIN_KABI_USE(1, atomic64_t futex_unique_id) + DEEPIN_KABI_RESERVE(2) +#else + /* + * 32-bit reserve words are four bytes each and only four-byte + * aligned, which cannot host the alignment atomic64_t needs (eight + * bytes on ARM EABI), so keep two u32 words and cast at the use + * sites. The anonymous struct above holds atomic64_t pinned_vm, + * so its size is a multiple of eight and this storage in fact sits + * at an eight-byte-aligned offset, keeping the casts safe and + * cpu_bitmap at its baseline offset on every layout. + */ + DEEPIN_KABI_USE(1, 2, u32 futex_unique_id[2]) +#endif +#else DEEPIN_KABI_RESERVE(1) DEEPIN_KABI_RESERVE(2) +#endif DEEPIN_KABI_RESERVE(3) DEEPIN_KABI_RESERVE(4) DEEPIN_KABI_RESERVE(5) diff --git a/kernel/fork.c b/kernel/fork.c index 294653c6f8b36..83b53293f0244 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1347,7 +1347,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, mm_init_uprobes_state(mm); hugetlb_count_init(mm); #ifdef CONFIG_FUTEX - atomic64_set(&mm->futex_unique_id, 0); + atomic64_set((atomic64_t *)&mm->futex_unique_id, 0); #endif if (current->mm) { diff --git a/kernel/futex/core.c b/kernel/futex/core.c index 71372f2dd6af3..c432029c4191f 100644 --- a/kernel/futex/core.c +++ b/kernel/futex/core.c @@ -348,7 +348,8 @@ int get_futex_key(u32 __user *uaddr, bool fshared, union futex_key *key, } key->both.offset |= FUT_OFF_MMSHARED; - key->private.mm_seq = get_object_id(&mm->futex_unique_id); + key->private.mm_seq = + get_object_id((atomic64_t *)&mm->futex_unique_id); key->private.address = address; } else { From 84786de18fc4839adfac6d95f4ef943b1319c7ae Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:52:30 +0800 Subject: [PATCH 2/6] dm: Fix kabi breakage in struct dm_target deepin inclusion category: kabi Commit d1c994e098ffa ("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: d1c994e098ffa ("dm-integrity: require stable writes for internal hash modes") Change-Id: I5e1f5b4096514a5aff5749526b9b484f74f32cd3 Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/device-mapper.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index f61daeeecee69..62cca2cd4dd65 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -356,11 +357,6 @@ struct dm_target { */ bool discards_supported:1; - /* - * Set if this target requires stable data during writeback. - */ - bool needs_stable_writes:1; - /* * Set if this target requires that discards be split on * 'max_discard_sectors' boundaries. @@ -401,6 +397,9 @@ struct dm_target { * bio_set_dev(). NOTE: ideally a target should _not_ need this. */ bool needs_bio_set_dev:1; + + /* Set if this target requires stable data during writeback. */ + DEEPIN_KABI_EXTEND(bool needs_stable_writes:1) }; void *dm_per_bio_data(struct bio *bio, size_t data_size); From b4bf296c5358e09085db6341a6481a6e50ab52d3 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:52:52 +0800 Subject: [PATCH 3/6] unicode: Fix kabi breakage in struct unicode_map deepin inclusion category: kabi Commit 89b23df684bd2 ("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: 89b23df684bd2 ("unicode: free the map after a grace period") Change-Id: I28f60e0c6b99d5f8d4a500cdf466e1b08ea2e76f Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/unicode.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/unicode.h b/include/linux/unicode.h index f5ee53dc4dff7..7fe1486bcb72f 100644 --- a/include/linux/unicode.h +++ b/include/linux/unicode.h @@ -4,6 +4,7 @@ #include #include +#include struct utf8data; struct utf8data_table; @@ -51,7 +52,7 @@ struct unicode_map { unsigned int version; const struct utf8data *ntab[UTF8_NMAX]; const struct utf8data_table *tables; - struct rcu_head rcu; + DEEPIN_KABI_EXTEND(struct rcu_head rcu) }; int utf8_validate(const struct unicode_map *um, const struct qstr *str); From 8c7877446c4af312a1e804807f001aa43d109620 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:53:05 +0800 Subject: [PATCH 4/6] perf: Fix kabi breakage in struct user_struct deepin inclusion category: kabi Commit 6bf27f8f5b778 ("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: 6bf27f8f5b778 ("perf: Track the perf mlock gift separately") Change-Id: Iafc77c06212e33244670a3b1e4502874a900387c Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/sched/user.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index ec262b605437c..bcd7e961b669f 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h @@ -7,6 +7,7 @@ #include #include #include +#include /* * Some day this will be a full-fledged user tracking system.. @@ -28,15 +29,15 @@ struct user_struct { defined(CONFIG_SECRETMEM) atomic_long_t locked_vm; /* pinned pages charged to RLIMIT_MEMLOCK */ #endif -#ifdef CONFIG_PERF_EVENTS - atomic_long_t perf_mlock; /* perf buffer pages within perf_event_mlock_kb */ -#endif #ifdef CONFIG_WATCH_QUEUE atomic_t nr_watches; /* The number of watches this user currently has */ #endif /* Miscellaneous per-user rate limit */ struct ratelimit_state ratelimit; +#ifdef CONFIG_PERF_EVENTS + DEEPIN_KABI_EXTEND(atomic_long_t perf_mlock) /* perf buffer pages */ +#endif }; extern int uids_sysfs_init(void); From 1820ee725dabad64b478213e7ed6a3641dfb2400 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:55:25 +0800 Subject: [PATCH 5/6] io_uring: Fix kabi breakage in struct io_kiocb deepin inclusion category: kabi Commit 7ecc4261e893a ("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: 7ecc4261e893a ("io_uring/cancel: don't default to setting req->work.cancel_seq") Change-Id: Ic13cd5433bc312f0118f8c82e6d9345f73b5f1a7 Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/io_uring_types.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index d05ed8c7ae1ee..4ca5de89acfa3 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -579,7 +580,8 @@ struct io_kiocb { __poll_t apoll_events; }; atomic_t refs; - bool cancel_seq_set; + DEEPIN_KABI_REPLACE(atomic_t poll_refs, + bool cancel_seq_set) struct io_task_work io_task_work; unsigned nr_tw; /* for polled requests, i.e. IORING_OP_POLL_ADD and async armed poll */ @@ -589,7 +591,6 @@ struct io_kiocb { /* opcode allocated if it needs to store data for async defer */ void *async_data; /* linked requests, IFF REQ_F_HARDLINK or REQ_F_LINK are set */ - atomic_t poll_refs; struct io_kiocb *link; /* custom credentials, valid IFF REQ_F_CREDS is set */ const struct cred *creds; @@ -599,6 +600,7 @@ struct io_kiocb { u64 extra1; u64 extra2; } big_cqe; + DEEPIN_KABI_EXTEND(atomic_t poll_refs) }; struct io_overflow_cqe { From 7beacf8352c1b203df36b19ea1a7f59dd3442977 Mon Sep 17 00:00:00 2001 From: Wentao Guan Date: Mon, 16 Nov 2026 18:55:25 +0800 Subject: [PATCH 6/6] io_uring: Fix kabi breakage in struct io_ring_ctx deepin inclusion category: kabi Commit cc8e033a409e6 ("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: cc8e033a409e6 ("io_uring: wake ring pollers for local task_work") Change-Id: I0e13ba4ec139094b93313c4785ba5dfd814371f1 Signed-off-by: shaoyang Signed-off-by: Wentao Guan --- include/linux/io_uring_types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index 4ca5de89acfa3..363c265cef21f 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -363,9 +363,6 @@ struct io_ring_ctx { bool iowq_limits_set; struct callback_head poll_wq_task_work; - /* deferred ->poll_wq wake up for local task_work */ - struct rcu_head poll_wq_rcu; - atomic_t poll_wq_rcu_pending; struct list_head defer_list; unsigned sq_thread_idle; /* protected by ->completion_lock */ @@ -379,6 +376,9 @@ struct io_ring_ctx { unsigned short n_sqe_pages; struct page **ring_pages; struct page **sqe_pages; + /* deferred ->poll_wq wake up for local task_work */ + DEEPIN_KABI_EXTEND(struct rcu_head poll_wq_rcu) + DEEPIN_KABI_EXTEND(atomic_t poll_wq_rcu_pending) }; struct io_tw_state {