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=1795154168; b=M3v1R2OUYr+0r5zYvUCUTePIzJC8lvhKM1I2A7tcmcXW78/V46DCJEtJuRfAgcVjSsLd fbRoMCnccCuFElEwC4CjidalXULf+gF6IvNvOC3a18xCQ1vcf8XyQM45sckL2X+xzPK8Y qYjWEPFOAw1Dqe7tAACCcScAqmr8113ieGoOiBLNTxLLFmW0/Oo9PZbr0DMAxntAuy7qm k91tpc+1Wm9N8j+62NRe5aSvwLbHP/gQz1P84g0CdYAL60nFohtWXRFA3DWobCT7yBQcK v7uSZ3kpUTgLRavhOkd7QagmYX4Gc037rEKMvCQ0ZAVfPXs2MpJayYfbwizEWo3wsEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795154168; 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-Type:Content-Transfer-Encoding; bh=/75VnOHpeT7OcY2uXZpasjxvSf1ave7Q7ypfO3l64S8=; b=e84Ssv0bBIlBWsLRvzLl4zKZe7mODOQEuvJhcsiBYIqpNxAIpESe/tcBiU8miCqPsfye gEVeUBjqZhDMdU06rtNvz3yFPl1HeGmhOMDHWIf6x4spG/uD9lnGwNzRnYT0gF9Q0Jgbz BT5dH/UzCGzvhF6CnjhAsVHhkF4/WZd9xOI7tNOxIjkC23pov0QL2C01CaKKP+Nx5cmgG tNmCIXWwMmNuRi8TjNlsVPBalgG+QNS/NRz206lRa+Rtv4c0OG2SKpHfXWnTI3SIv35aC BeJqdkm3ORn4haotYcBk+FqJ208VUDlI+Hq3/7mKBxlFMkp4JeK8Ui2eOvBFhfnZlew== 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=gIxH11Vm; 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 EF9AA606A320 for ; Fri, 20 Nov 2026 05:56:07 +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=gIxH11Vm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8311F000C4; Fri, 20 Nov 2026 05:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795154167; bh=/75VnOHpeT7OcY2uXZpasjxvSf1ave7Q7ypfO3l64S8=; h=From:To:Cc:Subject:Date:Reply-To; b=gIxH11VmXpwvM+YJ0Aotkb2EKXu+5wjhUUMgteDpfT2mgOJjWpdydjOqWSxPJrI5P bb7gnSbMkyIrkGJcDe9VpaAPBdih/zN7PA3GtvUCUtDiL39GE15EPiaXhFqGS/lFFh xWZ9eIvWXKLZ5t5dWRyGa0a1RmLHkmoZ6rU2OcFU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-99650: mm/ksm: fix use of a freed anon_vma at swap-in Date: Fri, 20 Nov 2026 06:50:36 +0100 Message-ID: <2026112043-CVE-2026-99650-0c59@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=4458; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=R8k/QK4hj/EvzQaP3w5wvfU2ZXgtuvifYuZZDTnnggI=; b=owGbwMvMwCRo6H6F97bub03G02pJDFn/71fM2mYZ4JR48F/R4T+rvkzaOfvSepHdV9Z4Nl38X nT1s9XjBx0xLAyCTAyyYoosX7bxHN1fcUjRy9D2NMwcViaQIQxcnAIwEeazDHNFTCY9M2a64vNC 9zOng9aF/muWC8UYporsPZZmHFdaYXE27+on2TSRpnkfAQ== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: mm/ksm: fix use of a freed anon_vma at swap-in A folio read from a swap slot previously shared by KSM can remain in the swap cache after the process that first mapped it exits. Its anon_vma can then be freed, so ksm_might_need_to_copy() must not dereference it to compare roots. Doing so can result in some false-positives, resulting in the reverse mapping missing the new folio mapping, preventing migration and reclaim. SLAB_TYPESAFE_BY_RCU allows individual anon_vma objects to be reused immediately after freeing. A stale pointer can then refer to another anon_vma whose root matches, even though the target VMA is not linked to that anon_vma. Move the anonymous rmap compatibility checks into folio_anon_rmap_compatible(). Keep the page-index check and compare the folio's anon_vma pointer against the VMA's own anon_vma and root first. If neither matches, bite the bullet and walk the VMA's anon_vma_chain. The VMA keeps these anon_vmas alive, and finding a match guarantees that reverse mapping can find the new mapping. Lorenzo Stoakes says in a private discussion: "This isn't quite equivalent to the existing check. Every anon_vma in an anon_vma_chain shares the same root, but if you split a VMA then fork both of them like this: VMA A / \ VMA B VMA C \ / root <- anon_vma 1 ----^ ^---- / parent \ anon_vma 2 anon_vma 3 | | VMA D VMA E VMA's D and E both get their own new anon_vma's such that: VMA D: anon_vma 2 -> anon_vma 1 -> root VMA E: anon_vma 3 -> anon_vma 1 -> root And if you found a folio referencing anon_vma 2, the existing check: anon_vma->root == vma->anon-vma->root Would be true for VMA's B, C, D & E. However after your change it'd be true for VMA D only, as it's the only one with anon_vma 2 in its anon_vma_chain. Whether or not that could actually happen in practice... 🙂 I don't know. [...] after your change it'd be true for VMA D only, as it's the only one with anon_vma 2 in its anon_vma_chain. [...] I would [...] say that you are making the test stricter but more correct. " If this affects performance when KSM was never even involved, we could just track whether KSM ever merged anything and just skip these checks. There isn't really a lot we can do otherwise: for mapped folios we might be able to use folio_get_anon_vma(), but for unmapped folios there really is no easy way to see if the anon_vma is still valid. Document the (confusing) lifetime requirements of folio_anon_vma(). The Linux kernel CVE team has assigned CVE-2026-99650 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.36 with commit ba6f0ff3981e6263ab81ac512f04cca55b85ec81 and fixed in 7.3.5 with commit 85260730efefc48111603fa865d224bae1f5447a Issue introduced in 2.6.36 with commit ba6f0ff3981e6263ab81ac512f04cca55b85ec81 and fixed in 7.4-rc2 with commit 4c2dec1dce368ad9e9b1814307cb5ef3832fa07e 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-99650 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/ksm.c mm/util.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/85260730efefc48111603fa865d224bae1f5447a https://git.kernel.org/stable/c/4c2dec1dce368ad9e9b1814307cb5ef3832fa07e