From mboxrd@z Thu Jan 1 00:00:00 1970 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 1B9FB30C174 for ; Wed, 24 Jun 2026 16:32:45 +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=1782318767; cv=none; b=pWyB4JBUgVzekb1Ph9yvyjHqlTQ6cOgi/qn7goifpaEzoEyk9FtL2Ik7fr+P9M+V6OHaBdLhNVpNnsDNdl4fvY/21jrefK12hs5xoPlfFTPpyNRF6pQhnkE9YD5ReKCACQzIklcBV7GwGldraT/UzQqHgaPsjaIM9CAxCuob1Yw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782318767; c=relaxed/simple; bh=KmtIu0yM1VeAXIO+VhIhqQ2/MQHAmwvf0GgZzxAzdgc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=O6W9QksV4K4rgPqqLyQZzEzM1xOlPwz3udBHvD2lTMMaU0SWBStIukGUpr6Yj06r6ca2D0JmK98H62iRgntZOfVaR4ZIzVmUyau+vi3/uuGFLTrLXpXaQUFwF3QE7irpyJm9JhV47hXYsON6DFUtmlYCwHuxkogPtDRbGegh1rY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Gwp/I33D; 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="Gwp/I33D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 286B11F000E9; Wed, 24 Jun 2026 16:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1782318765; bh=20FvSj1+ZflDp+EnkQjnDcRbe5OZKg6/F58oFtQHDKA=; h=From:To:Cc:Subject:Date:Reply-To; b=Gwp/I33DLXvcvoMVKA1GILrPSbEqAzS4Aj2PthN9hBca5SL/jvnSg8Waqt+d/etXr YBB2g5s7WoERhvC1tdUcfhR6/DpeUUGBTHUWt6SwynBUN9oyBiBjxQVJfvVgR1Z0TK bhUh7Cf5rkpKW3W44hl55ED4v7QEyMy7jfFUtw7Q= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2026-52969: KVM: Reject wrapped offset in kvm_reset_dirty_gfn() Date: Wed, 24 Jun 2026 17:29:53 +0100 Message-ID: <2026062439-CVE-2026-52969-8aa9@gregkh> X-Mailer: git-send-email 2.54.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4795; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=n3LBjz8Pm9/v/SqLo4wjp7KrlZQIarM+fBr76RwWHug=; b=owGbwMvMwCRo6H6F97bub03G02pJDFk2rJ+50hbc3pg984bYoVlex/SMzazl/74/8nXptfgOt UO2H8s7O2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiTKoMC9YVK4kJLuXd8+Hh JKcHC676bHF7/YlhJuO0ypep7F7Xfpzin+Tm3BdQuLLlOgA= 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: KVM: Reject wrapped offset in kvm_reset_dirty_gfn() kvm_reset_dirty_gfn() guards the gfn range with if (!memslot || (offset + __fls(mask)) >= memslot->npages) return; but offset is u64 and the addition is unchecked. The check can be silently bypassed by a u64 wrap. The dirty ring backing those entries is MAP_SHARED at KVM_DIRTY_LOG_PAGE_OFFSET of the vcpu fd, so the VMM can rewrite the slot and offset fields of any entry between when the kernel pushes them and when KVM_RESET_DIRTY_RINGS consumes them. On reset, kvm_dirty_ring_reset() re-reads the values via READ_ONCE() and feeds them straight back into this check; only the flags handshake is treated as the handover, the slot/offset payload is taken on trust. Crafting two entries entry[i].offset = 0xffffffffffffffc1 entry[i+1].offset = 0 makes the coalescing loop in kvm_dirty_ring_reset() compute delta = (s64)(0 - 0xffffffffffffffc1) = 63 which falls in [0, BITS_PER_LONG), so it folds entry[i+1] into the existing mask by setting bit 63. The trailing kvm_reset_dirty_gfn() call then sees offset = 0xffffffffffffffc1 and __fls(mask) = 63; the sum is 0 in u64 and the bounds check passes. That offset propagates into kvm_arch_mmu_enable_log_dirty_pt_masked() unchanged. On the legacy MMU path -- kvm_memslots_have_rmaps() == true, i.e. shadow paging, any VM that has allocated shadow roots, or a write-tracked slot -- it reaches gfn_to_rmap(), which indexes slot->arch.rmap[0][] with a near-U64_MAX gfn. That is an out-of-bounds load of a kvm_rmap_head, followed by a conditional clear of PT_WRITABLE_MASK in whatever the loaded pointer points at. The path is reachable from any process holding /dev/kvm. Range-check offset on its own first, so the addition cannot wrap. memslot->npages is bounded well below U64_MAX, so once offset < npages holds, offset + __fls(mask) (with __fls(mask) < BITS_PER_LONG) stays in range. The Linux kernel CVE team has assigned CVE-2026-52969 to this issue. Affected and fixed versions =========================== Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 5.15.209 with commit 74f1a22f7a80f03d28ad8551a2d25d563433addf Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 6.1.175 with commit 0eb281eb95b2d4eea4db1da5fe91023aecc97095 Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 6.6.141 with commit 01b71b930f15728aa8599478a7ce90c19dcd9fc2 Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 6.12.91 with commit b315b033a877b1ee6d827810b5d7bb4392ffcf8d Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 6.18.33 with commit 0d419c23bb11b5c9664de777c47c1f04a235882d Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 7.0.10 with commit ecf9b3ea7847fe14f34b8c41f00de1eb95c747da Issue introduced in 5.11 with commit fb04a1eddb1a65b6588a021bdc132270d5ae48bb and fixed in 7.1 with commit 577a8d3bae0531f0e5ccfac919cd8192f920a804 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-52969 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: virt/kvm/dirty_ring.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/74f1a22f7a80f03d28ad8551a2d25d563433addf https://git.kernel.org/stable/c/0eb281eb95b2d4eea4db1da5fe91023aecc97095 https://git.kernel.org/stable/c/01b71b930f15728aa8599478a7ce90c19dcd9fc2 https://git.kernel.org/stable/c/b315b033a877b1ee6d827810b5d7bb4392ffcf8d https://git.kernel.org/stable/c/0d419c23bb11b5c9664de777c47c1f04a235882d https://git.kernel.org/stable/c/ecf9b3ea7847fe14f34b8c41f00de1eb95c747da https://git.kernel.org/stable/c/577a8d3bae0531f0e5ccfac919cd8192f920a804