Re: [PATCH v15 06/13] x86/sev: Prevent GUEST_TSC_FREQ MSR interception for Secure TSC enabled guests

Borislav Petkov
2025-01-01T16:11:13Z

On Wed, Jan 01, 2025 at 02:14:38PM +0530, Nikunj A. Dadhania wrote:
> @@ -1437,8 +1471,16 @@ static enum es_result vc_handle_msr(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
> /* Is it a WRMSR? */
> write = ctxt->insn.opcode.bytes[1] == 0x30;
>
> - if (regs->cx == MSR_SVSM_CAA)
> + switch (regs->cx) {
> + case MSR_SVSM_CAA:
> return __vc_handle_msr_caa(regs, write);
> + case MSR_IA32_TSC:
> + case MSR_AMD64_GUEST_TSC_FREQ:
> + if (sev_status & MSR_AMD64_SNP_SECURE_TSC)
> + return __vc_handle_msr_tsc(regs, write);

Again: move all the logic inside __vc_handle_msr_tsc().

--
Regards/Gruss,
Boris.