[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241210115337.GAZ1grwdMmKXVE3Vpi@fat_crate.local>
Date: Tue, 10 Dec 2024 12:53:37 +0100
From: Borislav Petkov <bp@...en8.de>
To: Nikunj A Dadhania <nikunj@....com>
Cc: linux-kernel@...r.kernel.org, thomas.lendacky@....com, x86@...nel.org,
kvm@...r.kernel.org, mingo@...hat.com, tglx@...utronix.de,
dave.hansen@...ux.intel.com, pgonda@...gle.com, seanjc@...gle.com,
pbonzini@...hat.com
Subject: Re: [PATCH v15 05/13] x86/sev: Prevent RDTSC/RDTSCP interception for
Secure TSC enabled guests
On Tue, Dec 03, 2024 at 02:30:37PM +0530, Nikunj A Dadhania wrote:
> diff --git a/arch/x86/coco/sev/shared.c b/arch/x86/coco/sev/shared.c
> index 71de53194089..879ab48b705c 100644
> --- a/arch/x86/coco/sev/shared.c
> +++ b/arch/x86/coco/sev/shared.c
> @@ -1140,6 +1140,20 @@ static enum es_result vc_handle_rdtsc(struct ghcb *ghcb,
> bool rdtscp = (exit_code == SVM_EXIT_RDTSCP);
> enum es_result ret;
>
> + /*
> + * The hypervisor should not be intercepting RDTSC/RDTSCP when Secure
> + * TSC is enabled. A #VC exception will be generated if the RDTSC/RDTSCP
> + * instructions are being intercepted. If this should occur and Secure
> + * TSC is enabled, guest execution should be terminated as the guest
> + * cannot rely on the TSC value provided by the hypervisor.
> + *
> + * This file is included from kernel/sev.c and boot/compressed/sev.c,
> + * use sev_status here as cc_platform_has() is not available when
> + * compiling boot/compressed/sev.c.
> + */
diff --git a/arch/x86/coco/sev/shared.c b/arch/x86/coco/sev/shared.c
index 71c7024eb597..2e4122f8aa6b 100644
--- a/arch/x86/coco/sev/shared.c
+++ b/arch/x86/coco/sev/shared.c
@@ -1147,10 +1147,6 @@ static enum es_result vc_handle_rdtsc(struct ghcb *ghcb,
* instructions are being intercepted. If this should occur and Secure
* TSC is enabled, guest execution should be terminated as the guest
* cannot rely on the TSC value provided by the hypervisor.
- *
- * This file is included from kernel/sev.c and boot/compressed/sev.c,
- * use sev_status here as cc_platform_has() is not available when
- * compiling boot/compressed/sev.c.
*/
if (sev_status & MSR_AMD64_SNP_SECURE_TSC)
return ES_VMM_ERROR;
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists