Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 862EF47ECFB for ; Thu, 2 Jul 2026 12:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782996734; cv=none; b=lvl2gC1AIZQF7yfROmS+9htpdl7os2g966eDYP9gYKaM8XP1+cpXjn/dPtUXZQM/ke+btuXX6dZs7QarRav6tQVilm615ECkNQVL2mQkhQ33H9uKnu9vWTiWaNvyeixgq7nl1uWmI1Wcr6xgV52U6TzV4sB/tODS27RJdaiL0XQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782996734; c=relaxed/simple; bh=uj3iAgnntxty9IEA84TmMaUTkXx4gAhM+zqBOmAP8/Y=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=BYcM0Ls6WAxWcjWOYveJSBOwD+OaaduK17yNqK6iWpskp3bobhaP84+unODxkoHgCO53d1ad9ROBpv4mogPj4kmSvn0x6bZHOe76ynovoSl1p8QzS5GRVTHuDFU1ga7PAvGcBgDeV4xQMYK4XKWn6s2I2dX6quLP4cbr+epvbeY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HLd/Quax; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HLd/Quax" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68C71F000E9; Thu, 2 Jul 2026 12:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1782996732; bh=ryybzbAV4bUWOJ6gSSpwepFp92eTEKkrJNS5m+wAJXk=; h=Subject:To:Cc:From:Date; b=HLd/QuaxtWFl8iC8Hy5V59CV65ti9t6AyH8IIVSvV5R3YvDz5TNJiASvuBE0GRpkH F5WUXp79HAlMkvHipyF2qUp7CnCTbZ1SUpq9+TqK8mYsPUbpFlpBAA7FgDS1lmQ646 7nPlmkUVdjRiTe+/kE6Bkh+s1kw2OR9uSgxSmZsU= Subject: FAILED: patch "[PATCH] userfaultfd: ensure mremap_userfaultfd_fail() releases" failed to apply to 5.15-stable tree To: rppt@kernel.org,akpm@linux-foundation.org,brauner@kernel.org,david@kernel.org,jack@suse.cz,peterx@redhat.com,stable@vger.kernel.org,viro@zeniv.linux.org.uk Cc: From: Date: Thu, 02 Jul 2026 14:52:12 +0200 Message-ID: <2026070212-unlined-skinny-0311@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-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-5.15.y git checkout FETCH_HEAD git cherry-pick -x 0496a59745b0723ea74274db16fd5c8b1379b9a9 # git commit -s git send-email --to '' --in-reply-to '2026070212-unlined-skinny-0311@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 0496a59745b0723ea74274db16fd5c8b1379b9a9 Mon Sep 17 00:00:00 2001 From: "Mike Rapoport (Microsoft)" Date: Wed, 13 May 2026 11:14:16 +0300 Subject: [PATCH] userfaultfd: ensure mremap_userfaultfd_fail() releases mmap_changing Sashiko says: mremap_userfaultfd_prep() increments ctx->mmap_changing to stall concurrent operations, but mremap_userfaultfd_fail() does not decrement it before dropping the context reference. If an mremap operation fails, ctx->mmap_changing remains elevated. This will causes subsequent userfaultfd operations like a UFFDIO_COPY to fail with -EAGAIN. Decrement ctx->mmap_changing in mremap_userfaultfd_fail(). Link: https://sashiko.dev/#/patchset/20260430113512.115938-1-rppt@kernel.org Link: https://lore.kernel.org/20260513081416.495963-1-rppt@kernel.org Fixes: df2cc96e7701 ("userfaultfd: prevent non-cooperative events vs mcopy_atomic races") Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: David Hildenbrand (Arm) Cc: Al Viro Cc: Christian Brauner Cc: Jan Kara Cc: Peter Xu Cc: Signed-off-by: Andrew Morton diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 4b53dc4a3266..390e4b7d9cb9 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -786,6 +786,8 @@ void mremap_userfaultfd_fail(struct vm_userfaultfd_ctx *vm_ctx) if (!ctx) return; + atomic_dec(&ctx->mmap_changing); + VM_WARN_ON_ONCE(atomic_read(&ctx->mmap_changing) < 0); userfaultfd_ctx_put(ctx); }