From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796244303; b=YF/JUvwKoMpFcyfQZCSSstnqFskypBTgAJqQqU+5z2QEGEVYVZUzo2uyPKjzd2XSL7+n yUjBuL7QiEqBv4+F9ilMXRQvXtze70wJkM6x0y+pOnKfNckBqLwDJSt5S5JlsEh01mkJK j4Ynisz+8yfAKdSeEA7vmLhrMXmD5AnjOXUn5OOqe1Iq9/w14qcc84Uc7g4rNfERBq51j xt9QWAtf7un9r1YrtfaCXY+BRPjB4aMXSVfk6xrFsK7ye03CQbiZxWOUXRsY9oYVLgZlH I7yx/JvDlmyNwEnH+kgBbiFIKhjsy8neebhlH3W0j+l2+E4wIIzGyX1OwdSoX4TgIfw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796244303; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=jcdHyEQ8Bn/BuA9bHdferdK15XPcGx4yIb8PAK4SfQ8=; b=LbviIZLQHtSMVNfzmHGbByPQ2DFwo2X1Xqc7/Bd9UH+V9VL6uXk6zDv+gCemtVAG8KWW OUPNo8kk3NtPHhqX302nqrjW4kQEHsXioZE3HNIFOeurrVcV/AKbkecDOmyOmJkSrjNGF OzvCKkNW5xE2FI9CzlaU64g0+TD04ZEd0uOrMfR1f+/1UPsqy5UTBeRDZCkZS0Aggs2p+ P2Iuk10/4CIwkoKzUAqUKaCxSLvLN9szlEBTkbuz2FSyHmWNCrn3RncP9AVoDWqKJozCY w/jf2vDD6HsI7KRDKrTmB9OKiYlD4yz9gp/FewpAnJ76VZGj/cUT9uQq0aQ+KS8CAvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2Ge1KvwL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AD9E606A32C for ; Wed, 2 Dec 2026 20:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2Ge1KvwL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DAE01F0089C; Wed, 2 Dec 2026 20:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796244303; bh=jcdHyEQ8Bn/BuA9bHdferdK15XPcGx4yIb8PAK4SfQ8=; h=Date:To:From:In-Reply-To:References:Subject; b=2Ge1KvwLjwSlnVoZ4KHs/F41u4Y1SrAD2tWPrUOH3CmXA4uWVI0q30dM+WU9bc10A fCF6U9dP8mDtoZgDaTFqBtI/S5n7vqJoEeoyFMWMtfXiPuWS7n34WZzRKqMY10Hkvs 9wH7K4iksRD5IDOSjft0HBsP2ZC1uF0toU3VZR8k= Date: Wed, 02 Dec 2026 12:45:02 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,usama.arif@linux.dev, ryan.roberts@arm.com,nico.pache@linux.dev,liam@infradead.org, lance.yang@linux.dev,kas@kernel.org,irogers@google.com,dev.jain@arm.com, david@kernel.org,baolin.wang@linux.alibaba.com,baohua@kernel.org, elkin@google.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261202200056.3555477-1-elkin@google.com> References: <20261202200056.3555477-1-elkin@google.com> Subject: + mm-huge_memory-check-vma-end-bounds-in-insert_pmd-and-insert_pud.patch added to mm-new branch Message-Id: <20261202204503.3DAE01F0089C@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/huge_memory: check VMA end bounds in insert_pmd() and insert_pud() has been added to the -mm mm-new branch. Its filename is mm-huge_memory-check-vma-end-bounds-in-insert_pmd-and-insert_pud.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-huge_memory-check-vma-end-bounds-in-insert_pmd-and-insert_pud.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next 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 via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Elkin Cruz Subject: mm/huge_memory: check VMA end bounds in insert_pmd() and insert_pud() Date: Wed, 02 Dec 2026 20:00:56 +0000 insert_pmd() and insert_pud() currently check only that addr lies within [vma->vm_start, vma->vm_end), without verifying that the full PMD or PUD mapping fits below vma->vm_end. All current in-tree callers already validate VMA end alignment/bounds, so no existing user triggers this. Harden both helpers defensively by requiring addr + HPAGE_PMD_SIZE <= vma->vm_end in insert_pmd() and addr + HPAGE_PUD_SIZE <= vma->vm_end in insert_pud(). Link: https://patch.msgid.link/20261202200056.3555477-1-elkin@google.com Signed-off-by: Elkin Cruz Signed-off-by: Andrew Morton Reviewed-by: David Hildenbrand (Arm) Reviewed-by: Zi Yan Cc: Baolin Wang Cc: Liam R. Howlett Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Barry Song Cc: Lance Yang Cc: Usama Arif Cc: Kiryl Shutsemau Cc: Ian Rogers mm/huge_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/huge_memory.c~mm-huge_memory-check-vma-end-bounds-in-insert_pmd-and-insert_pud +++ a/mm/huge_memory.c @@ -1630,7 +1630,7 @@ static vm_fault_t insert_pmd(struct vm_a spinlock_t *ptl; pmd_t entry; - if (addr < vma->vm_start || addr >= vma->vm_end) + if (addr < vma->vm_start || addr + HPAGE_PMD_SIZE > vma->vm_end) return VM_FAULT_SIGBUS; if (arch_needs_pgtable_deposit()) { @@ -1768,7 +1768,7 @@ static vm_fault_t insert_pud(struct vm_a spinlock_t *ptl; pud_t entry; - if (addr < vma->vm_start || addr >= vma->vm_end) + if (addr < vma->vm_start || addr + HPAGE_PUD_SIZE > vma->vm_end) return VM_FAULT_SIGBUS; ptl = pud_lock(mm, pud); _ Patches currently in -mm which might be from elkin@google.com are mm-huge_memory-check-vma-end-bounds-in-insert_pmd-and-insert_pud.patch