+ mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/rmap: fix new bug: premature return from page_mlock_one()
has been added to the -mm tree.  Its filename is
     mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.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: Hugh Dickins <hughd@xxxxxxxxxx>
Subject: mm/rmap: fix new bug: premature return from page_mlock_one()

In the unlikely race case that page_mlock_one() finds VM_LOCKED has been
cleared by the time it got page table lock, page_vma_mapped_walk_done()
must be called before returning, either explicitly, or by a final call to
page_vma_mapped_walk() - otherwise the page table remains locked.

Link: https://lkml.kernel.org/r/f71f8523-cba7-3342-40a7-114abc5d1f51@xxxxxxxxxx
Fixes: cd62734ca60d ("mm/rmap: split try_to_munlock from try_to_unmap")
Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx>
Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Jason Gunthorpe <jgg@xxxxxxxxxx>
Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Ralph Campbell <rcampbell@xxxxxxxxxx>
Cc: Yang Shi <shy828301@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/rmap.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/mm/rmap.c~mm-rmap-fix-new-bug-premature-return-from-page_mlock_one
+++ a/mm/rmap.c
@@ -1991,14 +1991,13 @@ static bool page_mlock_one(struct page *
 			 * after DoubleMap was cleared).
 			 */
 			mlock_vma_page(page);
+			/*
+			 * No need to scan further once the page is marked
+			 * as mlocked.
+			 */
 			page_vma_mapped_walk_done(&pvmw);
+			return false;
 		}
-
-		/*
-		 * no need to continue scanning other vma's if the page has
-		 * been locked.
-		 */
-		return false;
 	}
 
 	return true;
_

Patches currently in -mm which might be from hughd@xxxxxxxxxx are

mm-rmap-fix-comments-left-over-from-recent-changes.patch
mm-rmap-fix-old-bug-munlocking-thp-missed-other-mlocks.patch
mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.patch
mm-rmap-try_to_migrate-skip-zone_device-device_private.patch
fs-mm-fix-race-in-unlinking-swapfile.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux