The patch titled
     Subject: mm/hugetlb: add migration entry check in hugetlb_change_protection
has been removed from the -mm tree.  Its filename was
     mm-hugetlb-add-migration-entry-check-in-hugetlb_change_protection.patch

This patch was dropped because an updated version will be merged

------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: mm/hugetlb: add migration entry check in hugetlb_change_protection

There is a race condition between hugepage migration and
change_protection(), where hugetlb_change_protection() doesn't care about
migration entries and wrongly overwrites them.  That causes unexpected
results like kernel crash.

This patch adds is_hugetlb_entry_(migration|hwpoisoned) check in this
function and skip all such entries.

Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: <[email protected]>    [3.12+]
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/hugetlb.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff -puN 
mm/hugetlb.c~mm-hugetlb-add-migration-entry-check-in-hugetlb_change_protection 
mm/hugetlb.c
--- 
a/mm/hugetlb.c~mm-hugetlb-add-migration-entry-check-in-hugetlb_change_protection
+++ a/mm/hugetlb.c
@@ -3358,7 +3358,13 @@ unsigned long hugetlb_change_protection(
                        spin_unlock(ptl);
                        continue;
                }
-               if (!huge_pte_none(huge_ptep_get(ptep))) {
+               pte = huge_ptep_get(ptep);
+               if (unlikely(is_hugetlb_entry_migration(pte) ||
+                            is_hugetlb_entry_hwpoisoned(pte))) {
+                       spin_unlock(ptl);
+                       continue;
+               }
+               if (!huge_pte_none(pte)) {
                        pte = huge_ptep_get_and_clear(mm, address, ptep);
                        pte = pte_mkhuge(huge_pte_modify(pte, newprot));
                        pte = arch_make_huge_pte(pte, vma, NULL, 0);
_

Patches currently in -mm which might be from [email protected] are

origin.patch
memory-hotplug-add-sysfs-zones_online_to-attribute.patch
mm-hugetlb-remove-unused-argument-of-follow_huge_pmdpud.patch
mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix.patch
do_shared_fault-check-that-mmap_sem-is-held.patch

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to