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: <7ca86282-6a6a-8f64-6ad9-20c9581841eb@amd.com>
Date: Mon, 5 Aug 2024 09:42:38 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Sean Christopherson <seanjc@...gle.com>,
 Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
 Weijiang Yang <weijiang.yang@...el.com>
Subject: Re: [PATCH v2 01/10] KVM: SVM: Disallow guest from changing
 userspace's MSR_AMD64_DE_CFG value

On 8/2/24 13:19, Sean Christopherson wrote:
> Inject a #GP if the guest attempts to change MSR_AMD64_DE_CFG from its
> *current* value, not if the guest attempts to write a value other than
> KVM's set of supported bits.  As per the comment and the changelog of the
> original code, the intent is to effectively make MSR_AMD64_DE_CFG read-
> only for the guest.
> 
> Opportunistically use a more conventional equality check instead of an
> exclusive-OR check to detect attempts to change bits.
> 
> Fixes: d1d93fa90f1a ("KVM: SVM: Add MSR-based feature support for serializing LFENCE")
> Cc: Tom Lendacky <thomas.lendacky@....com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@....com>

(one spelling correction below)

> ---
>  arch/x86/kvm/svm/svm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index c115d26844f7..550ead197543 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3189,8 +3189,13 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
>  		if (data & ~msr_entry.data)
>  			return 1;
>  
> -		/* Don't allow the guest to change a bit, #GP */
> -		if (!msr->host_initiated && (data ^ msr_entry.data))
> +		/*
> +		 * Don't let the guest change the host-programmed value.  The
> +		 * MSR is very model specific, i.e. contains multiple bits that
> +		 * are completely unknown to KVM, and the one bit known to KVM
> +		 * is simply a reflection of hardware capatibilies.

s/capatibilies/capabilities/

> +		 */
> +		if (!msr->host_initiated && data != svm->msr_decfg)
>  			return 1;
>  
>  		svm->msr_decfg = data;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ