Skip to contentSkip to conversation

mm-take-into-account-mm_cid-size-for-mm_struct-static-definitions.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jan 19 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: take into account mm_cid size for mm_struct static definitions
has been removed from the -mm tree. Its filename was
mm-take-into-account-mm_cid-size-for-mm_struct-static-definitions.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Mathieu Desnoyers <[email protected]>
Subject: mm: take into account mm_cid size for mm_struct static definitions
Date: Wed, 24 Dec 2025 12:33:58 -0500

Both init_mm and efi_mm static definitions need to make room for the 2 mm_cid cpumasks.

This fixes possible out-of-bounds accesses to init_mm and efi_mm.

Add a space between # and define for the mm_alloc_cid() definition to make it consistent with the coding style used in the rest of this header file.

Fixes af7f588d8f73 ("sched: Introduce per-memory-map concurrency ID")
Cc Mark Brown <[email protected]>
Cc Aboorva Devarajan <[email protected]>
Cc Al Viro <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Christan König <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc David Rientjes <[email protected]>
Cc Dennis Zhou <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc "Liam R . Howlett" <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Martin Liu <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Mateusz Guzik <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Miaohe Lin <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc SeongJae Park <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Sweet Tea Dorminy <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Wei Yang <[email protected]>
Cc Yu Zhao <[email protected]>
Cc Peter Zijlstra (Intel) <[email protected]>

---

 include/linux/mm_types.h |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-take-into-account-mm_cid-size-for-mm_struct-static-definitions +5 -2
@@ -1368,7 +1368,7 @@ extern struct mm_struct init_mm;
 
 #define MM_STRUCT_FLEXIBLE_ARRAY_INIT				\
 {								\
-	[0 ... sizeof(cpumask_t)-1] = 0				\
+	[0 ... sizeof(cpumask_t) + MM_CID_STATIC_SIZE - 1] = 0	\
 }
 
 /* Pointer magic because the dynamic array size confuses some compilers. */
@@ -1500,7 +1500,7 @@ static inline int mm_alloc_cid_noprof(st
 	mm_init_cid(mm, p);
 	return 0;
 }
-#define mm_alloc_cid(...)	alloc_hooks(mm_alloc_cid_noprof(__VA_ARGS__))
+# define mm_alloc_cid(...)	alloc_hooks(mm_alloc_cid_noprof(__VA_ARGS__))
 
 static inline void mm_destroy_cid(struct mm_struct *mm)
 {
@@ -1514,6 +1514,8 @@ static inline unsigned int mm_cid_size(v
 	return cpumask_size() + bitmap_size(num_possible_cpus());
 }
 
+/* Use 2 * NR_CPUS as worse case for static allocation. */
+# define MM_CID_STATIC_SIZE	(2 * sizeof(cpumask_t))
 #else /* CONFIG_SCHED_MM_CID */
 static inline void mm_init_cid(struct mm_struct *mm, struct task_struct *p) { }
 static inline int mm_alloc_cid(struct mm_struct *mm, struct task_struct *p) { return 0; }
@@ -1522,6 +1524,7 @@ static inline unsigned int mm_cid_size(v
 {
 	return 0;
 }
+# define MM_CID_STATIC_SIZE	0
 #endif /* CONFIG_SCHED_MM_CID */
 
 struct mmu_gather;

_

Patches currently in -mm which might be from [email protected] are

tsacct-skip-all-kernel-threads.patch mm-fix-oom-killer-inaccuracy-on-large-many-core-systems.patch