All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/migrate: Fixup setting UFFD_WP flag
@ 2020-08-24  8:31 Alistair Popple
  2020-08-24  8:31 ` [PATCH 2/2] mm/rmap: Fixup copying of soft dirty and uffd ptes Alistair Popple
  2020-08-24 15:44 ` [PATCH 1/2] mm/migrate: Fixup setting UFFD_WP flag Peter Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Alistair Popple @ 2020-08-24  8:31 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Andrew Morton, Peter Xu, Jérôme Glisse,
	John Hubbard, Ralph Campbell, Alistair Popple, stable

Commit f45ec5ff16a75 ("userfaultfd: wp: support swap and page
migration") introduced support for tracking the uffd wp bit during page
migration. However the non-swap PTE variant was used to set the flag for
zone device private pages which are a type of swap page.

This leads to corruption of the swap offset if the original PTE has the
uffd_wp flag set.

Fixes: f45ec5ff16a75 ("userfaultfd: wp: support swap and page migration")
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Cc: stable@vger.kernel.org
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 34a842a8eb6a..ddb64253fe3e 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -251,7 +251,7 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma,
 				entry = make_device_private_entry(new, pte_write(pte));
 				pte = swp_entry_to_pte(entry);
 				if (pte_swp_uffd_wp(*pvmw.pte))
-					pte = pte_mkuffd_wp(pte);
+					pte = pte_swp_mkuffd_wp(pte);
 			}
 		}
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-25  5:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24  8:31 [PATCH 1/2] mm/migrate: Fixup setting UFFD_WP flag Alistair Popple
2020-08-24  8:31 ` [PATCH 2/2] mm/rmap: Fixup copying of soft dirty and uffd ptes Alistair Popple
2020-08-24 15:43   ` Peter Xu
2020-08-25  5:19     ` Alistair Popple
2020-08-24 15:44 ` [PATCH 1/2] mm/migrate: Fixup setting UFFD_WP flag Peter Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.