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=1795153967; b=CA/uSY1dguac+hcCdoULouuRjdsqOllGdODzZW3wKKG7oxh4ws0BUp0VSa5PJ80q6Uzt b3n0lp9Y8yU635bxILfHn3aspjEHz1OdikPM75GW1Inbr2HlpR2wvRQTnTr8kyJ9ciShl scZO4tjb2DFH+TCew9ehO0apwKWxCVR9EkfPWoEw4ne6aF2/VBDI8EvgIZ4uIA2m/NReh YWBIwtp1M0OsEGHBSySCvjiFDQkDqThMhioKGGKClsm1V2F3Z9oznRRu6BFeNqloHvyLE C3ZrwEfPEWZw1MLKSoDDj3Q7+XBl5bmH5BAOioCc5lZWN/G+qv0M/i6WE1VM3lkwZPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795153967; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: Reply-To:MIME-Version:Lines:X-Developer-Signature:X-Developer-Key: Content-Transfer-Encoding; bh=BTBJ9xEM1vrrCClUjMmiX3h9cf2t5fS459n7llNHyUU=; b=BfmG5oYNsmgKHlVQRlZ5t3FyGT1uLlnTfZgQ8xHaed7L+Ofih+pqBgTLHwyrBEpftSdT HwsvaNzthxOSRHeoMzDQ5qhe83Y0l4BHb/O0gFkfDHCp/2Ab4Au1h1xHyNs67E6f86yqO JHDiY4BDTSoy6l69rlyc8acn9wM+5Yv3CQlavGkS6bjkrDKQbyDbqXJmrguNBZMNbXJH5 FnF3NgN1hKbVLox7TyCSkn0V7Sf6fa4wXovdr4C0qH+UkuXv7QLfpTHI73a6BHmL4PCWX I/3RHNYEW+2v6aLIUyy/FIykoQIL4GtqTcxiwjL7/8DPmjg47uE8WCL8qugXwnoFH2Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JK7z6PYY; 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 4B0DD606A320 for ; Fri, 20 Nov 2026 05:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JK7z6PYY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52CD11F000C4; Fri, 20 Nov 2026 05:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795153966; bh=BTBJ9xEM1vrrCClUjMmiX3h9cf2t5fS459n7llNHyUU=; h=From:To:Cc:Subject:Date:Reply-To; b=JK7z6PYYw2pDtsPAd3uZBQYGNPm9+9yhAWDRsI6H/+h01CLDFKl0Ye2ocXF6oM3KO wW5Se0NQZbnYFiNlIwZDWCuAIKyiZuBcKfoyxdIQ2A0IV970X69PzFoWrk3IYXXJ1M ji+qPL6ZC7ps8hOX03cS4wskzeUF1SvGq6wf/G0k= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99580: mm/userfaultfd: only allocate anon_vma in CoW mappings Date: Fri, 20 Nov 2026 06:49:26 +0100 Message-ID: <2026112018-CVE-2026-99580-9e2d@gregkh> X-Mailer: git-send-email 2.56.1 Reply-To: , X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4304; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=mjWUjevfVe/I4ug1AAdb6eukvI9xAwjmMWvAGnnhjbc=; b=owGbwMvMwCRo6H6F97bub03G02pJDFn/78fbCD76+Pp6ePp0wWN73rNdZ1z55+ey+YtvK+1+5 uYUkfAutSOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAm0r2ZYcFF71teb7w2Czsf vSJmsHjp5eg7t9QY5op8mZnAcv/5xRX3Tqst9Nql6nbRKRUA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: mm/userfaultfd: only allocate anon_vma in CoW mappings find_vma_and_prepare_anon() can end up allocating an anon_vma in VMAs that are not CoW mappings, which is wrong. If we have a MAP_SHARED R/O file mapped, we lack VM_SHARED (but do have VM_MAYSHARE) and lack VM_MAYWRITE. While uffd later rejects such mappings (uffd registration requires VM_MAYWRITE, see comment in validate_dst_vma) find_vma_and_prepare_anon() still wrongly allocates an anon vma before it validates the vma. This in turn later confuses copy_page_range()->vma_needs_copy() such that we end up calling copy_hugetlb_page_range() with ranges that actually do not contain *any* per-pagetable information that would require copying, which is the basis for PMD-table sharing in the first place. copy_hugetlb_page_range() should not have to worry about shared PMD tables at all: it doesn't make any sense to copy page tables that are shared, as they can be fully recreated later. Ending up in the function with shareable page tables is the real issue. If a destination PMD table is shared in copy_hugetlb_page_range(), it might get concurrently unshared as we are not holding relevant locks, resulting in us using a page table that is no longer mapped and possibly freed after calling: dst_pte = huge_pte_alloc(dst, dst_vma, addr, sz); To fix it, do not allocate an anon_vma in non-CoW mappings and add a safety guard to copy_hugetlb_page_range(), making sure that we never end up messing with shared PMD tables in there. Before commit 867a43a34ff8a ("userfaultfd: use per-vma locks in userfaultfd operations") we would always validate the VMA before allocating an anon_vma, and consequently never wrongly allocate an anon_vma. As uffd_lock_vma() is part of the same lookup machinery and also contains a misleading VM_SHARED check, change that one as well directly for consistency. A follow-up cleanup will stop taking the hugetlb_vma_lock_read(src_vma) lock in copy_hugetlb_page_range() entirely. Further, the usage of VM_SHARED in userfaultfd code should be cleaned up later to focus on CoW vs. non-CoW mappings. The Linux kernel CVE team has assigned CVE-2026-99580 to this issue. Affected and fixed versions =========================== Issue introduced in 6.9 with commit 867a43a34ff8a38772212045262b2c9b77807ea3 and fixed in 6.12.118 with commit a90e7044b34f801fbafcb682e8ee827a6db26002 Issue introduced in 6.9 with commit 867a43a34ff8a38772212045262b2c9b77807ea3 and fixed in 6.18.64 with commit 3bf446c8ce64938f86439906d730a2cd5c0b31e2 Issue introduced in 6.9 with commit 867a43a34ff8a38772212045262b2c9b77807ea3 and fixed in 7.3.5 with commit 20704188d669ed74a624fd67dfa4711bcb1087b6 Issue introduced in 6.9 with commit 867a43a34ff8a38772212045262b2c9b77807ea3 and fixed in 7.4-rc1 with commit 514c9247db305922591d806ec65d3c3fe420538d Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2026-99580 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: mm/hugetlb.c mm/userfaultfd.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/a90e7044b34f801fbafcb682e8ee827a6db26002 https://git.kernel.org/stable/c/3bf446c8ce64938f86439906d730a2cd5c0b31e2 https://git.kernel.org/stable/c/20704188d669ed74a624fd67dfa4711bcb1087b6 https://git.kernel.org/stable/c/514c9247db305922591d806ec65d3c3fe420538d