lib-test_hmm-avoid-accessing-uninitialized-pages.patch removed from -mm tree
The quilt patch titled
Subject: lib/test_hmm: avoid accessing uninitialized pages
has been removed from the -mm tree. Its filename was
lib-test_hmm-avoid-accessing-uninitialized-pages.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: Miaohe Lin <[email protected]>
Subject: lib/test_hmm: avoid accessing uninitialized pages
Date: Thu, 9 Jun 2022 21:08:35 +0800
If make_device_exclusive_range() fails or returns pages marked for exclusive access less than required, remaining fields of pages will left uninitialized. So dmirror_atomic_map() will access those yet uninitialized fields of pages. To fix it, do dmirror_atomic_map() iff all pages are marked for exclusive access (we will break if mapped is less than required anyway) so we won't access those uninitialized fields of pages.
---
lib/test_hmm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
lib/test_hmm.c renamed from lib/test_hmm.c~lib-test_hmm-avoid-accessing-uninitialized-pages +8 -2
@@ -732,7 +732,7 @@ static int dmirror_exclusive(struct dmirmmap_read_lock (mm);for (addr = start; addr < end; addr = next) { -unsigned long mapped; +unsigned long mapped =0 ;int i;if (end < addr + (ARRAY_SIZE (pages) <<PAGE_SHIFT ))
@@ -741,7 +741,13 @@ static int dmirror_exclusive(struct dmir next = addr + (ARRAY_SIZE (pages) <<PAGE_SHIFT ); ret =make_device_exclusive_range (mm, addr, next, pages,NULL ); - mapped =dmirror_atomic_map (addr, next, pages, dmirror); +/* +* Do dmirror_atomic_map() iff all pages are marked for +* exclusive access to avoid accessing uninitialized +* fields of pages. +*/ +if (ret == (next - addr) >>PAGE_SHIFT ) + mapped =dmirror_atomic_map (addr, next, pages, dmirror);for (i =0 ; i < ret; i++) {if (pages[i]) {unlock_page (pages[i]);
_
Patches currently in -mm which might be from [email protected] are
mm-reduce-the-rcu-lock-duration.patch mm-migration-remove-unneeded-lock-page-and-pagemovable-check.patch mm-migration-return-errno-when-isolate_huge_page-failed.patch mm-migration-fix-potential-pte_unmap-on-an-not-mapped-pte.patch mm-swapfile-make-security_vm_enough_memory_mm-work-as-expected.patch mm-swapfile-fix-possible-data-races-of-inuse_pages.patch mm-swap-remove-swap_cache_info-statistics.patch mm-vmscan-dont-try-to-reclaim-freed-folios.patch mm-page_alloc-minor-clean-up-for-memmap_init_compound.patch