FAILED: patch "[PATCH] mm/hugetlb: fix use-after-free in hugetlb_mfill_atomic_pte()" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x d8a9cd7fd2fb01211430c933932da58839b8ca65
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110447-friend-unmanaged-5374@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d8a9cd7fd2fb01211430c933932da58839b8ca65 Mon Sep 17 00:00:00 2001
From: "David Hildenbrand (Arm)" <[email protected]>
Date: Thu, 15 Oct 2026 18:07:09 +0200
Subject: [PATCH] mm/hugetlb: fix use-after-free in hugetlb_mfill_atomic_pte()
Let's fix another instance where we use a folio after dropping the PTL, where someone else could e.g., MADV_DONTNEED it once we drop the PTL, making us trigger a use-after-free on the folio.
mm/hugetlb.c +6 -1
@@ -6520,11 +6520,16 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte,/* No need to invalidate - it was non-present before */ update_mmu_cache (dst_vma, dst_addr, dst_pte); -spin_unlock (ptl);if (!is_continue)folio_set_hugetlb_migratable (folio);if (vm_shared || is_continue)folio_unlock (folio); + +/* +* Hold the PTL until we're done with the folio: the page table owns the +* folio reference now. +*/ +spin_unlock (ptl); ret =0 ; out:return ret;
Sasha Levin
maintainerPATCH 1/1 mm/hugetlb: fix use-after-free in hugetlb_mfill_atomic_pte()
From: "David Hildenbrand (Arm)" <[email protected]>
[ Upstream commit d8a9cd7fd2fb01211430c933932da58839b8ca65 ]
Let's fix another instance where we use a folio after dropping the PTL, where someone else could e.g., MADV_DONTNEED it once we drop the PTL, making us trigger a use-after-free on the folio.
--- mm/hugetlb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
mm/hugetlb.c +6 -1
@@ -4806,10 +4806,15 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,/* No need to invalidate - it was non-present before */ update_mmu_cache (dst_vma, dst_addr, dst_pte); -spin_unlock (ptl);set_page_huge_active (page);if (vm_shared)unlock_page (page); + +/* +* Hold the PTL until we're done with the page: the page table owns the +* page reference now. +*/ +spin_unlock (ptl); ret =0 ; out:return ret;
Signature · 1 line
2.53.0