From patchwork Mon Aug 24 08:31:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 11732371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C14C4913 for ; Mon, 24 Aug 2020 08:34:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 857FB21741 for ; Mon, 24 Aug 2020 08:34:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=popple.id.au header.i=@popple.id.au header.b="C3rzlWdc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 857FB21741 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=popple.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 968DB6B000C; Mon, 24 Aug 2020 04:34:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8A0396B0005; Mon, 24 Aug 2020 04:34:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 718966B000A; Mon, 24 Aug 2020 04:34:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id 4AA396B0005 for ; Mon, 24 Aug 2020 04:34:58 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 11BE7362C for ; Mon, 24 Aug 2020 08:34:58 +0000 (UTC) X-FDA: 77184801876.11.table37_5a0c67827051 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id D508D180F8B81 for ; Mon, 24 Aug 2020 08:34:57 +0000 (UTC) X-Spam-Summary: 1,0,0,10519603753c888a,d41d8cd98f00b204,alistair@popple.id.au,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1261:1311:1314:1345:1431:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:4250:5007:6261:6653:7903:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:13069:13311:13357:13894:14096:14181:14384:14394:14721:21080:21451:21627:30054,0,RBL:203.11.71.1:@popple.id.au:.lbl8.mailshell.net-64.201.201.201 62.14.32.100;04yf8gexks6c4fywosq656hokir6qypsrcktuhm6osfsueg5sfixifuto6zmq6f.gxz6irt63mtmzmwwfaq89889f6gxbfbp41956sh5a6r76otkz5sfpm1xgxdr38i.e-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:381,LUA_SUMMARY:none X-HE-Tag: table37_5a0c67827051 X-Filterd-Recvd-Size: 2787 Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 08:34:56 +0000 (UTC) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BZlmX32Kmz9sPB; Mon, 24 Aug 2020 18:34:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=popple.id.au; s=202006; t=1598258093; bh=B7PNZnSY6ZfbLv7chxp4iihY52HWlmjN0VC92TU+vSU=; h=From:To:Cc:Subject:Date:From; b=C3rzlWdckFpUv3mCwBnbKR3eu8hr/yMHqefUWdAsdba4EFZYwEqsUkQGgyXogOSGf JFGbpHuV/lcVDquhEERC1Zc91krNoTEXixwPTJ6wmttuWNII/Fyvhj2TU/uRuuvEjz ZMzS9nM5+jsrcEsL6zBvLF/aX7kRvMgtTLFKpB8bjImxgZ1RPDKsbgX2tai6ufkAyN vcRzd2+Ps5Yj6zESTMZBZQ9dNPPcwXMw6hJaV1nZ81s6kvnFtVSCU7+R7E9qJMehyE dLWJ1tvKCJyi7u/2ILTsI9DVTXuaVAAfVYF748ZljFgKv/dht3zTe8uapeiZgkI+7J vpBzH2MM7rXNg== From: Alistair Popple To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , Peter Xu , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , John Hubbard , Ralph Campbell , Alistair Popple , stable@vger.kernel.org Subject: [PATCH 1/2] mm/migrate: Fixup setting UFFD_WP flag Date: Mon, 24 Aug 2020 18:31:27 +1000 Message-Id: <20200824083128.12684-1-alistair@popple.id.au> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: D508D180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Cc: stable@vger.kernel.org Reviewed-by: Peter Xu --- 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); } }