The patch titled Subject: mm/vmalloc.c: vmap(): don't allow invalid pages has been added to the -mm tree. Its filename is vmap-dont-allow-invalid-pages.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/vmap-dont-allow-invalid-pages.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/vmap-dont-allow-invalid-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yury Norov <yury.norov@xxxxxxxxx> Subject: mm/vmalloc.c: vmap(): don't allow invalid pages vmap() takes struct page *pages as one of arguments, and user may provide an invalid pointer which would lead to data abort at address translation later. Currently, kernel checks the pages against NULL. In my case, however, the address was not NULL, and was big enough so that the hardware generated Address Size Abort on arm64. Interestingly, this abort happens even if copy_from_kernel_nofault() is used, which is quite inconvenient for debugging purposes. This patch adds a pfn_valid() check into vmap() path, so that invalid mapping will not be created. Link: https://lkml.kernel.org/r/20220119012109.551931-1-yury.norov@xxxxxxxxx Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx> Suggested-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Ding Tianhong <dingtianhong@xxxxxxxxxx> Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Alexey Klimov <aklimov@xxxxxxxxxx> Cc: Uladzislau Rezki <urezki@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmalloc.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/vmalloc.c~vmap-dont-allow-invalid-pages +++ a/mm/vmalloc.c @@ -479,6 +479,8 @@ static int vmap_pages_pte_range(pmd_t *p return -EBUSY; if (WARN_ON(!page)) return -ENOMEM; + if (WARN_ON(!pfn_valid(page_to_pfn(page)))) + return -EINVAL; set_pte_at(&init_mm, addr, pte, mk_pte(page, prot)); (*nr)++; } while (pte++, addr += PAGE_SIZE, addr != end); _ Patches currently in -mm which might be from yury.norov@xxxxxxxxx are vmap-dont-allow-invalid-pages.patch