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]
Message-ID: <584e51cc-1a79-4e5d-45ef-1850bb6c155e@redhat.com>
Date:   Tue, 13 Feb 2018 17:22:25 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Tom Lendacky <thomas.lendacky@....com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...en8.de>,
        Thomas Gleixner <tglx@...utronix.de>,
        Radim Krčmář <rkrcmar@...hat.com>
Subject: Re: [RFC PATCH 2/2] KVM: SVM: Add MSR feature support for serializing
 LFENCE

On 08/02/2018 23:58, Tom Lendacky wrote:
> Create an entry in the new MSR as a feature framework to allow a guest to
> recognize LFENCE as a serializing instruction on AMD processors.  The MSR
> can only be set by the host, any write by the guest will be ignored.  A
> read by the guest will return the value as set by the host.  In this way,
> the support to expose the feature to the guest is controlled by the
> hypervisor.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@....com>
> ---
>  arch/x86/kvm/svm.c |   16 ++++++++++++++++
>  arch/x86/kvm/x86.c |    6 ++++++
>  2 files changed, 22 insertions(+)
> 
> @@ -4047,6 +4052,17 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
>  	case MSR_VM_IGNNE:
>  		vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
>  		break;
> +	case MSR_F10H_DECFG:
> +		/* Only the host can set this MSR, silently ignore */
> +		if (!msr->host_initiated)
> +			break;

Just one thing I'm wondering, should we #GP if the guest attempts to
clear MSR_F10H_DECFG_LFENCE_SERIALIZE?

Thanks,

Paolo

> +
> +		/* Check the supported bits */
> +		if (!kvm_valid_msr_feature(MSR_F10H_DECFG, data))
> +			return 1;
> +
> +		svm->msr_decfg = data;
> +		break;
>  	case MSR_IA32_APICBASE:
>  		if (kvm_vcpu_apicv_active(vcpu))
>  			avic_update_vapic_bar(to_svm(vcpu), data);
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 4251c34..21ec73b 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1060,7 +1060,13 @@ struct kvm_msr_based_features {
>  	u64 value;			/* MSR value */
>  };
>  
> +static const struct x86_cpu_id msr_decfg_match[] = {
> +	{ X86_VENDOR_AMD, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_LFENCE_RDTSC },
> +	{}
> +};
> +
>  static struct kvm_msr_based_features msr_based_features[] = {
> +	{ MSR_F10H_DECFG, MSR_F10H_DECFG_LFENCE_SERIALIZE, msr_decfg_match },
>  	{}
>  };
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ