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=1794273214; b=ob8HTk/J2reeNQzVCT8+neMoYHy8hmjhFlWG3ICcb21pjxNvcldvcSSIXZzY8eT9KTBo ZwVSjbXjoaWpI7jkIDXt6ttMF/Cp+gDki4+vo27u9ieMBWblFDXRtIbNvv8TTmxrSEFDU G+MvJ3P1iSbTWsaiSpiq8MN/wZGf+cKto6syVzmTba7l0xbaMTrhZSlSncJHU1k5KtghT SyM3sMm3KXPvf+QNRL2xSL5R9CRGUV4haqbUArdnDnyup5Ww1W8RBdE33QNh6smt9AmGc Xjc9y5iJutUlLjNuS/9knfLrO/me16xfxBpWQIXT+MEG0yaf4POtZGMTVRS8Ib1YlDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794273214; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=MRjXIR1WPhw3KmreztTz9jtW6DJiZJRDdevxlj/jxKM=; b=ZYZ6uCmQjgxDPGsav/UvxJIcwCdie5gk1GHk+3qeCEO7t2tTR5ILGSl5rgqRi03+X+dS 7IoyoW3FNGjGqkRHT8ThYqd5ZTeneyEIvD/xr1KPPP36t8DyxBdg8Ay05LF1h9Kwn4FqN 7+YFHQya2JTBZBq9KMq8yzVGl+W6dLBn5cr43Rkt08K1hw+CQiHBAYwfYibbOwHTwbUFa +X+JsrDEluOhlnZ1FVvX+ZuBesgwOeO2xLFKNIlVdKwkumPGpScBZF3zJxGDS43IBEut+ EiKNWZnMTgjKmw5ICQtxdTQ0Mto+B+21Jdzn33tsGHRDpVmoroz5cVU522/JbNOhuAQ== 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="N/ZzcHea"; 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 11B8F606A31C for ; Tue, 10 Nov 2026 01:13:34 +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=N/ZzcHea Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A4EA1F0089F; Tue, 10 Nov 2026 01:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794273213; bh=MRjXIR1WPhw3KmreztTz9jtW6DJiZJRDdevxlj/jxKM=; h=From:To:Cc:Subject:Date; b=N/ZzcHeaVbuvHDuLw9l45CEKj0KREZUeRUDLjHeCzVig8REeO70eCmrWd/1BIpZiE OEKdaf0FnN7lCjlOrbu8gM+wbFspMh+XYNHsxQlbKuhVRTCgPt0dbfHEbAQjpDtJPV xOVFYk3RiDxykDyWdhAMczBrcYhj+xQmFpinGiTQ6XVO3sZlv44/KkZdD/wL/KveVc 5MW9X3s5mHQR1zyx2/ptXuA7dGi9xVj6l/ytQ4PCpbdvLzcfVTwmuzI4gMIHRROpXI g+b6CghMKCnTFpOIV+qwbbRpfFOrCTmU5R0ieKrNzb6nUuA688Mj2a1XpHQ1yN1AbE IdfesaRptbH9w== From: Sasha Levin To: josef@toxicpanda.com, rppt@kernel.org, ljs@kernel.org, usama.anjum@arm.com, david@kernel.org Cc: stable@vger.kernel.org Subject: FAILED: patch "[PATCH] mm/userfaultfd: wake all waiters on unregister" failed to apply to 6.6-stable tree Date: Mon, 9 Nov 2026 20:13:32 -0500 Message-ID: <20261109201332-failed-6.6-3afb19d68cc5@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 3afb19d68cc5e7851fdb1069c8094af97bd80417 # git commit -s git send-email --to '' --in-reply-to '20261109201332-failed-6.6-3afb19d68cc5@kernel.org' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From 3afb19d68cc5e7851fdb1069c8094af97bd80417 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Sat, 31 Oct 2026 10:39:53 +0100 Subject: [PATCH] mm/userfaultfd: wake all waiters on unregister UFFDIO_UNREGISTER only wakes pending faults if VM_UFFD_MISSING is set. Threads waiting on write-protect, minor or RWP faults can therefore remain asleep after unregistering a range that does not track missing faults. Wake pending faults regardless of the registration mode so they can retry without an explicit UFFDIO_WAKE or closing the userfaultfd. This matches the existing behavior for missing faults, including removing unread fault messages for the woken waiters. Fix generated by an LLM and sent by Josef Bacik in private. Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl") Cc: stable@vger.kernel.org Signed-off-by: Josef Bacik [ david: rebase; simplify description ] Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Lorenzo Stoakes (ARM) Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-24-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) --- mm/userfaultfd.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 3ca04b582329f..be630674fda9b 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -3977,6 +3977,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, ret = 0; for_each_vma_range(vmi, vma, end) { + struct userfaultfd_wake_range range; + cond_resched(); /* VMA not registered with userfaultfd. */ @@ -3994,18 +3996,14 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, /* Prevent new userfaults from being queued after the wakeup. */ vma_start_write(vma); - if (userfaultfd_missing(vma)) { - /* - * Wake any concurrent pending userfault while - * we unregister, so they will not hang - * permanently and it avoids userland to call - * UFFDIO_WAKE explicitly. - */ - struct userfaultfd_wake_range range; - range.start = start; - range.len = vma_end - start; - wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range); - } + /* + * Wake any concurrent pending userfault while we unregister, + * so they will not hang permanently and it avoids userland to + * call UFFDIO_WAKE explicitly. + */ + range.start = start; + range.len = vma_end - start; + wake_userfault(ctx, &range); vma = userfaultfd_clear_vma(&vmi, prev, vma, start, vma_end); -- 2.53.0