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=1794273497; b=c9RLQRTp6OeXaFIrGKoLgfZ7faYIfIBBEiSEuQBWa5o0whnZ3brBaSNaBaE03ElYcsSJ xMxWOcXuef+cQQmpNa5UUb+cA+J92p993cALLT009LmLyHBEGi1CiS96kMpaEnZpXJ1I4 L38Wvuq5ACCLg8iPp+aXYQO2Nbs9uFG+pgq11xkIQwNcwQU4frnIdp+82hNy8v4Ui9+nD ZOSzKVavOChEakfClVOGFMBHmDwdmrM6KIlZN1Q9xmHaaGG61OohAZ22lnnoG5IC+jtHD Px//Dgd9jwF16+SvdKdlk6fy/HLRqQ90TWJZDgqd90NHDFj7jq5GxGlNcrfLzLyZZNg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794273497; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=ODa+s96MQwf+f6fuerb/7DAOllLDcSrgl4HisSyieyM=; b=HzzfOWyLqaU9Fw6w4MWiA8o+BUU3gtwGtXFBO5wZprtyEK7kf6uEbV0LVR5PLk7f/vkm OK9AdSDS1sNq0V/TIWkhclShGozF8DzkO3Cw189eJpw4yoRxWrGl+FuK8GTAVMCxlxQcA eLTgHS8QbhQx0umcxUCPQHaXyfaIW2hLDieuwWbkVf2iERnzB6ANxHytwBSYVOUjnxu04 wub/+nmsE4Ti6aceHWEVW7GtgDcJxP8vNypvuCgekD6GpJoOxQFMKd2tWQ2t3QL5psZVx o19RTCd6yFEGXVxbOyTU2VFUssInKflbz3kjph/b6FcVWpguNAwXa9SZAanJXXlFuAQ== 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=n6+gG76H; 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 92670606A321 for ; Tue, 10 Nov 2026 01:18:17 +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=n6+gG76H Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD4761F0089F; Tue, 10 Nov 2026 01:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794273497; bh=ODa+s96MQwf+f6fuerb/7DAOllLDcSrgl4HisSyieyM=; h=From:To:Cc:Subject:Date; b=n6+gG76HwmlQLcCtt90w18YchkUGyDaUVMt5O2j2iWsXCeTqB6vVnkP3kVKOkxrvD OcmWAUSo8Rxb725BlZJKmxS4CycV4QPm4BDoEi0QF8nhK7kVNlnLyKc2o03YvNEYlD a6o/ZEaAwPO46KwVgutjzSf9Fm8WaAQGBiXRhbOlBn2EXsXg4NZIGKyIbpqGJfOu0i JFWdvDVV2weRsvlUW60XbErSbK3ylbQ63JFDJeKcV2HFkUJiL4X+7pgYcAzHSfnAB+ MoL1jmnpsG5fdBs+j1w3Nfv3JWZq3Y/NNiv/u+dd0ZOVTJGAjpt6Hgg4GABVqo3SfU OwOMIT/CQeIbA== 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.1-stable tree Date: Mon, 9 Nov 2026 20:18:15 -0500 Message-ID: <20261109201815-failed-6.1-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.1-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.1.y git checkout FETCH_HEAD git cherry-pick -x 3afb19d68cc5e7851fdb1069c8094af97bd80417 # git commit -s git send-email --to '' --in-reply-to '20261109201815-failed-6.1-3afb19d68cc5@kernel.org' --subject-prefix 'PATCH 6.1.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