lib-test_vmallocc-avoid-garbage-in-page-array.patch removed from -mm tree
The quilt patch titled
Subject: lib/test_vmalloc.c: avoid garbage in page array
has been removed from the -mm tree. Its filename was
lib-test_vmallocc-avoid-garbage-in-page-array.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: Lorenzo Stoakes <[email protected]>
Subject: lib/test_vmalloc.c: avoid garbage in page array
Date: Wed, 24 May 2023 09:24:24 +0100
It turns out that alloc_pages_bulk_array() does not treat the page_array parameter as an output parameter, but rather reads the array and skips any entries that have already been allocated.
This is somewhat unexpected and breaks this test, as we allocate the pages array uninitialised on the assumption it will be overwritten.
As a result, the test was referencing uninitialised data and causing the PFN to not be valid and thus a WARN_ON() followed by a null pointer deref and panic.
In addition, this is an array of pointers not of struct page objects, so we need only allocate an array with elements of pointer size.
We solve both problems by simply using kcalloc() and referencing sizeof(struct page *) rather than sizeof(struct page).
---
lib/test_vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_vmalloc.c renamed from lib/test_vmalloc.c~lib-test_vmallocc-avoid-garbage-in-page-array +1 -1
@@ -369,7 +369,7 @@ vm_map_ram_test(void)int i; map_nr_pages = nr_pages >0 ? nr_pages:1 ; - pages =kmalloc (map_nr_pages *sizeof (struct page ),GFP_KERNEL ); + pages =kcalloc (map_nr_pages,sizeof (struct page *),GFP_KERNEL );if (!pages)return -1 ;
_
Patches currently in -mm which might be from [email protected] are
mm-vmalloc-do-not-output-a-spurious-warning-when-huge-vmalloc-fails.patch mm-mmap-separate-writenotify-and-dirty-tracking-logic.patch mm-gup-disallow-foll_longterm-gup-nonfast-writing-to-file-backed-mappings.patch mm-gup-disallow-foll_longterm-gup-fast-writing-to-file-backed-mappings.patch mm-gup-add-missing-gup_must_unshare-check-to-gup_huge_pgd.patch mm-gup-remove-unused-vmas-parameter-from-get_user_pages.patch mm-gup-remove-unused-vmas-parameter-from-pin_user_pages_remote.patch mm-gup-remove-vmas-parameter-from-get_user_pages_remote.patch io_uring-rsrc-delegate-vma-file-backed-check-to-gup.patch mm-gup-remove-vmas-parameter-from-pin_user_pages.patch mm-gup-remove-vmas-array-from-internal-gup-functions.patch mm-mmap-refactor-mlock_future_check.patch mm-vmalloc-dont-purge-usable-blocks-unnecessarily-fix.patch