lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Sep 2023 15:57:58 -0500
From:   Tom Lendacky <thomas.lendacky@....com>
To:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org, x86@...nel.org
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Babu Moger <babu.moger@....com>
Subject: Re: [PATCH v2 2/3] KVM: SVM: Fix TSC_AUX virtualization intercept
 update logic

On 9/15/23 15:54, Tom Lendacky wrote:
> With the TSC_AUX virtualization support now in the vcpu_set_after_cpuid()
> path, the intercepts must be either cleared or set based on the guest
> CPUID input. Currently the support only clears the intercepts.
> 
> Also, vcpu_set_after_cpuid() calls svm_recalc_instruction_intercepts() as
> part of the processing, so the setting or clearing of the RDTSCP intercept
> can be dropped from the TSC_AUX virtualization support.
> 
> Update the support to always set or clear the TSC_AUX MSR intercept based
> on the virtualization requirements.
> 
> Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
> Signed-off-by: Tom Lendacky <thomas.lendacky@....com>

In the end, I was really on the fence about this being a separate patch 
given the common Fixes: tag. Your call, feel free to squash with patch #1 
and massage the commit message if you'd like (or I can send a v3 with them 
squashed if you prefer).

Thanks,
Tom

> ---
>   arch/x86/kvm/svm/sev.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 4ac01f338903..4900c078045a 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -2966,12 +2966,11 @@ static void sev_es_vcpu_after_set_cpuid(struct vcpu_svm *svm)
>   {
>   	struct kvm_vcpu *vcpu = &svm->vcpu;
>   
> -	if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) &&
> -	    (guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP) ||
> -	     guest_cpuid_has(vcpu, X86_FEATURE_RDPID))) {
> -		set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, 1, 1);
> -		if (guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP))
> -			svm_clr_intercept(svm, INTERCEPT_RDTSCP);
> +	if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
> +		bool v_tsc_aux = guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP) ||
> +				 guest_cpuid_has(vcpu, X86_FEATURE_RDPID);
> +
> +		set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, v_tsc_aux, v_tsc_aux);
>   	}
>   }
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ