Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 16FBE2ED86A for ; Fri, 25 Jul 2025 15:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753457352; cv=none; b=mINeYfc49YYT9UEjITE9xp7m2/gX6Joqb6wGOw9J2pfzYdXKm1kmKyewGIQmn4DspaEJX/6zUZw4Cc5Rc596ewClRrAQHhuok0NpZQM7hoS6yul46ycMRkNSuKm30me7czqsdq1R+7OEM0R0Cf/weyKCa5gVMLjH2fdIHoN5pKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753457352; c=relaxed/simple; bh=ZOIY+r60lZDFxWy0RBv1Y6Rb+fXmPMMzso+8ZoXTUpI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gkIrmBQko8tjGXG/kRMzEDcHEQuubjXYTZKGGH/ijZSTWirK4gzB50pMAWjpxQI9vYT0I2OP4Bub4gkQk4x85vQvgnNTUphERha/reOq0Vsve+MScfoNhFCYFFmjzfBQs+P9s05GEmrPBDzakjiXupE9cPmQEpF5bPIylZbwYFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fW8X7WiR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fW8X7WiR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F796C4CEE7; Fri, 25 Jul 2025 15:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753457351; bh=ZOIY+r60lZDFxWy0RBv1Y6Rb+fXmPMMzso+8ZoXTUpI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fW8X7WiR+oNiEC60+As10qKPJd3yhRB1B9zSk/KuPVX7tOyZRumlC57YA8uVJeFyI 4yt8UyLk+zjQ/x/WgBsfuGzKHpvLUwE6P/zkN40mJFInTSY99tjyjar+i6UPCJdrtn yGGDXUFeB9TKAbvQsoW3bqCJ1uwT61tR9989OpUk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38455: KVM: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight Date: Fri, 25 Jul 2025 17:28:17 +0200 Message-ID: <2025072505-CVE-2025-38455-9331@gregkh> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=6533; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=le2oYESJklrQzoJ4nD0x6cdxwCXWm4+GcFeBGozwOFY=; b=owGbwMvMwCRo6H6F97bub03G02pJDBnNi9rux6/Z5v1IR7aBj0/IRF9R4bAy87U7Lmweupp3N +9dvkmhI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZyw5xhfsH+yyo3XgfYvU6q WHYrhmnO+uOfNjHM96y/+SPm64vfD95afuhddFjzufGvowA= 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: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight Reject migration of SEV{-ES} state if either the source or destination VM is actively creating a vCPU, i.e. if kvm_vm_ioctl_create_vcpu() is in the section between incrementing created_vcpus and online_vcpus. The bulk of vCPU creation runs _outside_ of kvm->lock to allow creating multiple vCPUs in parallel, and so sev_info.es_active can get toggled from false=>true in the destination VM after (or during) svm_vcpu_create(), resulting in an SEV{-ES} VM effectively having a non-SEV{-ES} vCPU. The issue manifests most visibly as a crash when trying to free a vCPU's NULL VMSA page in an SEV-ES VM, but any number of things can go wrong. BUG: unable to handle page fault for address: ffffebde00000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP KASAN NOPTI CPU: 227 UID: 0 PID: 64063 Comm: syz.5.60023 Tainted: G U O 6.15.0-smp-DEV #2 NONE Tainted: [U]=USER, [O]=OOT_MODULE Hardware name: Google, Inc. Arcadia_IT_80/Arcadia_IT_80, BIOS 12.52.0-0 10/28/2024 RIP: 0010:constant_test_bit arch/x86/include/asm/bitops.h:206 [inline] RIP: 0010:arch_test_bit arch/x86/include/asm/bitops.h:238 [inline] RIP: 0010:_test_bit include/asm-generic/bitops/instrumented-non-atomic.h:142 [inline] RIP: 0010:PageHead include/linux/page-flags.h:866 [inline] RIP: 0010:___free_pages+0x3e/0x120 mm/page_alloc.c:5067 Code: <49> f7 06 40 00 00 00 75 05 45 31 ff eb 0c 66 90 4c 89 f0 4c 39 f0 RSP: 0018:ffff8984551978d0 EFLAGS: 00010246 RAX: 0000777f80000001 RBX: 0000000000000000 RCX: ffffffff918aeb98 RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffebde00000000 RBP: 0000000000000000 R08: ffffebde00000007 R09: 1ffffd7bc0000000 R10: dffffc0000000000 R11: fffff97bc0000001 R12: dffffc0000000000 R13: ffff8983e19751a8 R14: ffffebde00000000 R15: 1ffffd7bc0000000 FS: 0000000000000000(0000) GS:ffff89ee661d3000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffebde00000000 CR3: 000000793ceaa000 CR4: 0000000000350ef0 DR0: 0000000000000000 DR1: 0000000000000b5f DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: sev_free_vcpu+0x413/0x630 arch/x86/kvm/svm/sev.c:3169 svm_vcpu_free+0x13a/0x2a0 arch/x86/kvm/svm/svm.c:1515 kvm_arch_vcpu_destroy+0x6a/0x1d0 arch/x86/kvm/x86.c:12396 kvm_vcpu_destroy virt/kvm/kvm_main.c:470 [inline] kvm_destroy_vcpus+0xd1/0x300 virt/kvm/kvm_main.c:490 kvm_arch_destroy_vm+0x636/0x820 arch/x86/kvm/x86.c:12895 kvm_put_kvm+0xb8e/0xfb0 virt/kvm/kvm_main.c:1310 kvm_vm_release+0x48/0x60 virt/kvm/kvm_main.c:1369 __fput+0x3e4/0x9e0 fs/file_table.c:465 task_work_run+0x1a9/0x220 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x7f0/0x25b0 kernel/exit.c:953 do_group_exit+0x203/0x2d0 kernel/exit.c:1102 get_signal+0x1357/0x1480 kernel/signal.c:3034 arch_do_signal_or_restart+0x40/0x690 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x67/0xb0 kernel/entry/common.c:218 do_syscall_64+0x7c/0x150 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f87a898e969 Modules linked in: gq(O) gsmi: Log Shutdown Reason 0x03 CR2: ffffebde00000000 ---[ end trace 0000000000000000 ]--- Deliberately don't check for a NULL VMSA when freeing the vCPU, as crashing the host is likely desirable due to the VMSA being consumed by hardware. E.g. if KVM manages to allow VMRUN on the vCPU, hardware may read/write a bogus VMSA page. Accessing PFN 0 is "fine"-ish now that it's sequestered away thanks to L1TF, but panicking in this scenario is preferable to potentially running with corrupted state. The Linux kernel CVE team has assigned CVE-2025-38455 to this issue. Affected and fixed versions =========================== Issue introduced in 5.16 with commit b56639318bb2be66aceba92836279714488709b4 and fixed in 6.1.146 with commit e0d9a7cf37ca09c513420dc88e0d0e805a4f0820 Issue introduced in 5.16 with commit b56639318bb2be66aceba92836279714488709b4 and fixed in 6.6.99 with commit 8c8e8d4d7544bb783e15078eda8ba2580e192246 Issue introduced in 5.16 with commit b56639318bb2be66aceba92836279714488709b4 and fixed in 6.12.39 with commit fd044c99d831e9f837518816c7c366b04014d405 Issue introduced in 5.16 with commit b56639318bb2be66aceba92836279714488709b4 and fixed in 6.15.7 with commit b5725213149597cd9c2b075b87bc4e0f87e906c1 Issue introduced in 5.16 with commit b56639318bb2be66aceba92836279714488709b4 and fixed in 6.16-rc6 with commit ecf371f8b02d5e31b9aa1da7f159f1b2107bdb01 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-2025-38455 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: arch/x86/kvm/svm/sev.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/e0d9a7cf37ca09c513420dc88e0d0e805a4f0820 https://git.kernel.org/stable/c/8c8e8d4d7544bb783e15078eda8ba2580e192246 https://git.kernel.org/stable/c/fd044c99d831e9f837518816c7c366b04014d405 https://git.kernel.org/stable/c/b5725213149597cd9c2b075b87bc4e0f87e906c1 https://git.kernel.org/stable/c/ecf371f8b02d5e31b9aa1da7f159f1b2107bdb01