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 021512D47E9 for ; Mon, 15 Sep 2025 14:24:29 +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=1757946270; cv=none; b=R38//DPlm10TRlOvRFNG27qGmrfa7K9yDegZ8vvwmFvUzn0XvkoEK+Sb8IsxIybarc4nEHzC7KAzu+T9pLX4g3VavW5aJI+P+c0g2C5MrtJTpeQVGpUmQUuhpIc0O/0E1/La6NVSvg81JbwkQ3ViCexrYT9eMaDODPIGpdVqM4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757946270; c=relaxed/simple; bh=7o64S9mM7RFzjq1sDkbWfaEpnUuWD2ywKBdDKg+RvEs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sayerjJU9Lf7sCt1OZ87lu1BHqz5+U+RH/wmoxrwgxX8wc9Gvtm6KYTrXamvW8ZbAiMazgkSB6LZdKCTTYPhWdP3Zc/fVbODc+jjUXKxT9uEetklvWrNxQis/ubIz0EXGIXlrep61F3GD6w4yz3MbI8edBY2sZwW1Fj8eUuoLVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZTic0HgY; 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="ZTic0HgY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECA09C4CEF1; Mon, 15 Sep 2025 14:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757946269; bh=7o64S9mM7RFzjq1sDkbWfaEpnUuWD2ywKBdDKg+RvEs=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ZTic0HgYyxaBrT7Li5VEbWEjAqjopmZ+FjeRXiqk/bm8jX78ap98g1yCb45xx3hyh DkjzXmghdXrMgW1yaIbM7PrM6AME4ItEKTEm/0chHzXX+2/Ja4GPnhdGs92YbAXyvr 4j1WN2dlzkA9Kl0jLzFK+jx/5O7KZaaGQAfYWW3g= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53208: KVM: nSVM: Load L1's TSC multiplier based on L1 state, not L2 state Date: Mon, 15 Sep 2025 16:21:42 +0200 Message-ID: <2025091510-CVE-2023-53208-b31d@gregkh> X-Mailer: git-send-email 2.51.0 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=3825; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=8BeEynGUxcBxRr/npLmsQKOb1rd20MGCqpWXFp3V5Do=; b=owGbwMvMwCRo6H6F97bub03G02pJDBknFK5tFZv6c6Xbf+ULbt91Juy9bzfh+xpV70OHra+pR ZdM5QiX7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJuAQzLJjDKq95Qmo22/b7 y1kig80v3XwbKM4wP1SuYoFWZEtjAcuErabr57z0WZu8EwA= 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: nSVM: Load L1's TSC multiplier based on L1 state, not L2 state When emulating nested VM-Exit, load L1's TSC multiplier if L1's desired ratio doesn't match the current ratio, not if the ratio L1 is using for L2 diverges from the default. Functionally, the end result is the same as KVM will run L2 with L1's multiplier if L2's multiplier is the default, i.e. checking that L1's multiplier is loaded is equivalent to checking if L2 has a non-default multiplier. However, the assertion that TSC scaling is exposed to L1 is flawed, as userspace can trigger the WARN at will by writing the MSR and then updating guest CPUID to hide the feature (modifying guest CPUID is allowed anytime before KVM_RUN). E.g. hacking KVM's state_test selftest to do vcpu_set_msr(vcpu, MSR_AMD64_TSC_RATIO, 0); vcpu_clear_cpuid_feature(vcpu, X86_FEATURE_TSCRATEMSR); after restoring state in a new VM+vCPU yields an endless supply of: ------------[ cut here ]------------ WARNING: CPU: 10 PID: 206939 at arch/x86/kvm/svm/nested.c:1105 nested_svm_vmexit+0x6af/0x720 [kvm_amd] Call Trace: nested_svm_exit_handled+0x102/0x1f0 [kvm_amd] svm_handle_exit+0xb9/0x180 [kvm_amd] kvm_arch_vcpu_ioctl_run+0x1eab/0x2570 [kvm] kvm_vcpu_ioctl+0x4c9/0x5b0 [kvm] ? trace_hardirqs_off+0x4d/0xa0 __se_sys_ioctl+0x7a/0xc0 __x64_sys_ioctl+0x21/0x30 do_syscall_64+0x41/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd Unlike the nested VMRUN path, hoisting the svm->tsc_scaling_enabled check into the if-statement is wrong as KVM needs to ensure L1's multiplier is loaded in the above scenario. Alternatively, the WARN_ON() could simply be deleted, but that would make KVM's behavior even more subtle, e.g. it's not immediately obvious why it's safe to write MSR_AMD64_TSC_RATIO when checking only tsc_ratio_msr. The Linux kernel CVE team has assigned CVE-2023-53208 to this issue. Affected and fixed versions =========================== Issue introduced in 5.16 with commit 5228eb96a4875f8cf5d61d486e3795ac14df8904 and fixed in 6.1.54 with commit 5b2b0535fa7adee7e295fed0a3095082131a8d05 Issue introduced in 5.16 with commit 5228eb96a4875f8cf5d61d486e3795ac14df8904 and fixed in 6.5.4 with commit e91c07f6cf7060d2acb3aeee31a6baebe3773d3f Issue introduced in 5.16 with commit 5228eb96a4875f8cf5d61d486e3795ac14df8904 and fixed in 6.6 with commit 0c94e2468491cbf0754f49a5136ab51294a96b69 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-2023-53208 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/nested.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/5b2b0535fa7adee7e295fed0a3095082131a8d05 https://git.kernel.org/stable/c/e91c07f6cf7060d2acb3aeee31a6baebe3773d3f https://git.kernel.org/stable/c/0c94e2468491cbf0754f49a5136ab51294a96b69