Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1424619

[PATCH v1 2/2] mm: rmap: call page_check_address() with sync enabled to avoid racy check

From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject [PATCH v1 2/2] mm: rmap: call page_check_address() with sync enabled to avoid racy check
Date 2016-06-17 04:40 +0200
Message-ID <rKRRo-uH-9@gated-at.bofh.it> (permalink)
References <rKRRo-uH-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The previous patch addresses the race between split_huge_pmd_address() and
someone changing the pmd. The fix is only for splitting of normal thp
(i.e. pmd-mapped thp,) and for splitting of pte-mapped thp there still is
the similar race.

For splitting pte-mapped thp, the pte's conversion is done by
try_to_unmap_one(TTU_MIGRATION). This function checks page_check_address() to
get the target pte, but it can return NULL under some race, leading to
VM_BUG_ON() in freeze_page(). Fortunately, page_check_address() already has
an argument to decide whether we do a quick/racy check or not, so let's flip
it when called from freeze_page().

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/rmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git v4.6/mm/rmap.c v4.6_patched/mm/rmap.c
index 4282b56..c357fb36 100644
--- v4.6/mm/rmap.c
+++ v4.6_patched/mm/rmap.c
@@ -1424,7 +1424,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
 			goto out;
 	}
 
-	pte = page_check_address(page, mm, address, &ptl, 0);
+	pte = page_check_address(page, mm, address, &ptl,
+				 PageTransCompound(page));
 	if (!pte)
 		goto out;
 
-- 
2.7.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 1/2] mm: thp: move pmd check inside ptl for freeze_page() Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-06-17 04:40 +0200
  [PATCH v1 2/2] mm: rmap: call page_check_address() with sync enabled to avoid racy check Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-06-17 04:40 +0200
  Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-17 10:50 +0200
    Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-06-20 11:00 +0200
      Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-20 11:40 +0200
        Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-21 17:10 +0200
          Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-06-22 03:40 +0200
            Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-06-22 04:50 +0200
              Re: [PATCH v1 1/2] mm: thp: move pmd check inside ptl for  freeze_page() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-22 14:10 +0200

csiph-web