Skip to contentSkip to conversation

mm-compaction-fix-ubsan-shift-out-of-bounds-warning.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 26, 2025 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/compaction: fix UBSAN shift-out-of-bounds warning
has been removed from the -mm tree. Its filename was
mm-compaction-fix-ubsan-shift-out-of-bounds-warning.patch

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

------------------------------------------------------
From: Liu Shixin <[email protected]>
Subject: mm/compaction: fix UBSAN shift-out-of-bounds warning
Date: Thu, 23 Jan 2025 10:10:29 +0800

syzkaller reported a UBSAN shift-out-of-bounds warning of (1UL << order) in isolate_freepages_block(). The bogus compound_order can be any value because it is union with flags. Add back the MAX_PAGE_ORDER check to fix the warning.

Fixes 3da0272a4c7d ("mm/compaction: correctly return failure with bogus compound_order in strict mode")
Cc Baolin Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Kemeng Shi <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Nanyong Sun <[email protected]>

---

 mm/compaction.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/compaction.c renamed from mm/compaction.c~mm-compaction-fix-ubsan-shift-out-of-bounds-warning +2 -1
@@ -631,7 +631,8 @@ static unsigned long isolate_freepages_b
 		if (PageCompound(page)) {
 			const unsigned int order = compound_order(page);
 
-			if (blockpfn + (1UL << order) <= end_pfn) {
+			if ((order <= MAX_PAGE_ORDER) &&
+			    (blockpfn + (1UL << order) <= end_pfn)) {
 				blockpfn += (1UL << order) - 1;
 				page += (1UL << order) - 1;
 				nr_scanned += (1UL << order) - 1;

_

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

mm-page_isolation-avoid-call-folio_hstate-without-hugetlb_lock.patch