]> git.baikalelectronics.ru Git - kernel.git/commit
mm/rmap: fixup copying of soft dirty and uffd ptes
authorAlistair Popple <alistair@popple.id.au>
Fri, 4 Sep 2020 23:36:01 +0000 (16:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 5 Sep 2020 19:14:30 +0000 (12:14 -0700)
commit96b0f11f785372d4230acc350e14120a77b564e1
treefae495fca608cb7cd9776442142552de4ce681f7
parent1f1762edcc620187f6ad0c63d83c15423b6853ad
mm/rmap: fixup copying of soft dirty and uffd ptes

During memory migration a pte is temporarily replaced with a migration
swap pte.  Some pte bits from the existing mapping such as the soft-dirty
and uffd write-protect bits are preserved by copying these to the
temporary migration swap pte.

However these bits are not stored at the same location for swap and
non-swap ptes.  Therefore testing these bits requires using the
appropriate helper function for the given pte type.

Unfortunately several code locations were found where the wrong helper
function is being used to test soft_dirty and uffd_wp bits which leads to
them getting incorrectly set or cleared during page-migration.

Fix these by using the correct tests based on pte type.

Fixes: a56ecb24d40e ("mm/migrate: support un-addressable ZONE_DEVICE page in migration")
Fixes: 3b4c5288d4b6 ("mm/migrate: migrate_vma() unmap page from vma while collecting pages")
Fixes: 2dd1c0fd164d ("userfaultfd: wp: support swap and page migration")
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Alistair Popple <alistair@popple.id.au>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20200825064232.10023-2-alistair@popple.id.au
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/migrate.c
mm/rmap.c