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] [day] [month] [year] [list]
Message-ID: <7deeb8ea-816c-f1d6-aa4b-2e64c6c8659c@redhat.com>
Date:   Thu, 18 Apr 2019 18:36:45 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Borislav Petkov <bp@...en8.de>,
        Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     KVM <kvm@...r.kernel.org>, lkml <linux-kernel@...r.kernel.org>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        Tony Luck <tony.luck@...el.com>,
        Yazen Ghannam <Yazen.Ghannam@....com>
Subject: Re: [PATCH -v5.1] x86/kvm: Implement HWCR support

On 18/04/19 16:19, Borislav Petkov wrote:
> On Thu, Apr 18, 2019 at 06:56:06AM -0700, Sean Christopherson wrote:
>> This doesn't allow writing '0' regardless of msr_hwcr.BIT(18), which was
>> previously supported.
> 
> Restored the old conditional:
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 10f6acc6494c..f74f1280745b 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2318,7 +2318,8 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  				return -1;
>  
>  			/* MCi_STATUS */
> -			if ((offset & 0x3) == 1 && !msr_info->host_initiated) {
> +			if (!msr_info->host_initiated &&
> +			    (offset & 0x3) == 1 && data != 0) {
>  				if (!can_set_mci_status(vcpu))
>  					return -1;
>  			}
> 
>> And there's no need for multiple if statements.
> 
> It is a bit more readable this way.
> 
> Actually, I'd break that if above into smaller if-statements with
> flipped logic to make it even more readable:
> 
> 	if (msr_info->host_initiated)
> 		goto set_msr;
> 
> 	if (!(offset & 0x3))
> 		goto set_msr;
> 
> 	if (!data)
> 		goto set_msr;
> 
> 	if (!can_set_mci_status(vcpu))
> 		return -1;
> 
> set_msr:
> 	...
> 
> 
> Anything else? Can I send v5.2 now?

No need, squashing this in before running away for vacation.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ