From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794273235; b=Qgmob+K8mTTjbbZq7Mter3FuWTcsbAXXETV/CHAxy2ijxVquDWPJnYVomFWTnyofqDwO lhfiuePPJ7TO7FFankpLjYsN8bjrs3Z2ybMhEREXlAb2cz3m4E9lvtCYdaRSsA5l0gJmf 9IuGQ9yI2YimvWMHgQE/mbpl+JKqFvJgvPU9nTNkrSQuJlney4cNZkEaw8dggcBfjj1oK vC/eahSTioVbAmujLd9/p8Jyyw6SMUyBmNbtC2tgPjWYokFWNvIsCGq2/k7n35EGJze/d PyYWMidP9TaNGYYm5mP03An0Hw8441ympeUevUBgISWz3daQnW65T7bSZWHhWW+6rnQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794273235; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=cy/Qo2hWFjQwe0VK2IwIf9ZlexJ+lAvrUwVz55JK9RM=; b=G70bUktgDRxihxfv1j3VzGOh4xzEaddmss966okMxF7rsdfHibETBvBx0CX48tyoWbGF r5PA1uwc2cwWGH8cT0r9AlSgWDj/bol+Fxgarq85SxmXwnMhtbwANPiHAXqRwoe4ZMW25 96bb/dcfWUOo3QCbl0V2JLSyySXpbwGknniA+3C1uFkrGExAsjvnvBDGdUoVi/EowiJ0p 4u7YE1Zga+9K2cl58iEF6kTf/s/O+F5FtjvPbvI8wrnUppAAHLCX5FuesRYxoN4Ztxv/B OV1y2QKTcVdw3WEzLAkk2xRyvMZ8uwRBvjRy9JoOGumOGoZYkr9AY1nQx+Fgemd8/8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aYVFNQkB; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B031C606A326 for ; Tue, 10 Nov 2026 01:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aYVFNQkB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 875D61F0089F; Tue, 10 Nov 2026 01:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794273234; bh=cy/Qo2hWFjQwe0VK2IwIf9ZlexJ+lAvrUwVz55JK9RM=; h=From:To:Cc:Subject:Date; b=aYVFNQkBSTbz87eMecytu/P0cSOe2/neeNSS+3YWxT/Me1wsNYTtYfunmpuxhzl2j 7PiWBlqUoNFTJSGC8qzUg2bWuXJG+FqAKEoOQ9pGXakSDwjmDQQb9V5DGR1m8DsTdQ gHrMARemlXO2FsTFY7j0gTMnaQcfjew5ZzegpYM470fhBRK8WjR8aJfUKD3/t62cYw dn/Rp9UavSAj6jE6rtHdf8jOKGxAtF2txNPyxQYwM75grRiqvClS+z7il/Yi2Mwp4Z niPsppABzBDAvFFggHphqpgHGXjyrj0VWlHfZglBc7oQbYAXSOFEelSis30Ulwbzrp +TikPVf10x2lQ== From: Sasha Levin To: mason@kernel.org, ljs@kernel.org, pfalcato@suse.de, usama.anjum@arm.com, david@kernel.org Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] mm/memory: reject remote COW faults on PFN mappings" failed to apply to 6.6-stable tree Date: Mon, 9 Nov 2026 20:13:52 -0500 Message-ID: <20261109201352-failed-6.6-8db6921cc07b@kernel.org> X-Mailer: git-send-email 2.53.0 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 8db6921cc07b74197a3866d62ed262b68aeadcf3 # git commit -s git send-email --to '' --in-reply-to '20261109201352-failed-6.6-8db6921cc07b@kernel.org' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From 8db6921cc07b74197a3866d62ed262b68aeadcf3 Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Sat, 31 Oct 2026 10:40:04 +0100 Subject: [PATCH] mm/memory: reject remote COW faults on PFN mappings When handling a COW fault without a normal source page (PFN mappings), __wp_page_copy_user() copies from the faulting user address. For remote faults, this accesses the wrong address space, resulting in wrong data getting copied. For example, user_events updates an enable bit in the registering process's memory. If that memory needs to be faulted in, user_event_enabler_fault_fixup() calls fixup_user_fault() from a work item. Placing the enable bit in a private PFN mapping can trigger this remote COW path. Reject these faults with VM_FAULT_SIGBUS when the target mm differs from current->mm: remote faults. Ordinary (non-PFN) mappings are not affected. The user-address copy dates back to commit 6aab341e0a28 ("mm: re-architect the VM_UNPAGED logic"); likely, actual ways to get remote faults in there on COW PFN mappings appeared afterwards. But the fix is simple and straight forward. Fix generated by an LLM and sent by Chris Mason in private. Fixes: 6aab341e0a28 ("mm: re-architect the VM_UNPAGED logic") Cc: stable@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) [ david: simplify comment and description ] Reviewed-by: Pedro Falcato Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-35-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) --- mm/memory.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index 5392bcb1d24d6..ae8d567bc6ba3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3761,6 +3761,13 @@ static inline int __wp_page_copy_user(struct page *dst, struct page *src, return 0; } + /* + * __copy_from_user_inatomic() only works as expected for local faults. + * Reject remote faults. + */ + if (unlikely(mm != current->mm)) + return -EFAULT; + /* * If the source page was a PFN mapping, we don't have * a "struct page" for it. We do a best-effort copy by @@ -4086,6 +4093,8 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) folio_put(old_folio); delayacct_wpcopy_end(); + if (err == -EFAULT) + return VM_FAULT_SIGBUS; return err == -EHWPOISON ? VM_FAULT_HWPOISON : 0; } kmsan_copy_page_meta(&new_folio->page, vmf->page); -- 2.53.0