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:   Thu, 26 Mar 2020 20:43:46 +0800
From:   Xiaoyao Li <xiaoyao.li@...el.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        hpa@...or.com, Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Arvind Sankar <nivedita@...m.mit.edu>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH v6 8/8] kvm: vmx: virtualize split lock detection

On 3/26/2020 7:10 PM, Thomas Gleixner wrote:
> Xiaoyao Li <xiaoyao.li@...el.com> writes:
>> On 3/25/2020 8:40 AM, Thomas Gleixner wrote:
>>> Xiaoyao Li <xiaoyao.li@...el.com> writes:
>>>>    static int handle_exception_nmi(struct kvm_vcpu *vcpu)
>>>>    {
>>>>    	struct vcpu_vmx *vmx = to_vmx(vcpu);
>>>> @@ -4725,12 +4746,13 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
>>>>    	case AC_VECTOR:
>>>>    		/*
>>>>    		 * Reflect #AC to the guest if it's expecting the #AC, i.e. has
>>>> -		 * legacy alignment check enabled.  Pre-check host split lock
>>>> -		 * support to avoid the VMREADs needed to check legacy #AC,
>>>> -		 * i.e. reflect the #AC if the only possible source is legacy
>>>> -		 * alignment checks.
>>>> +		 * legacy alignment check enabled or split lock detect enabled.
>>>> +		 * Pre-check host split lock support to avoid further check of
>>>> +		 * guest, i.e. reflect the #AC if host doesn't enable split lock
>>>> +		 * detection.
>>>>    		 */
>>>>    		if (!split_lock_detect_on() ||
>>>> +		    guest_cpu_split_lock_detect_on(vmx) ||
>>>>    		    guest_cpu_alignment_check_enabled(vcpu)) {
>>>
>>> If the host has split lock detection disabled then how is the guest
>>> supposed to have it enabled in the first place?
>>>
>> It is ||
> 
> Again. If the host has it disabled, then the feature flag is OFF. So
> how is the hypervisor exposing it in the first place?
> 

So what's wrong with above code?

If the host has it disabled, !split_lock_detect_on() is true, it skips 
following check due to ||

I guess you want something like below?

if (!boot_cpu_has(X86_FEATURE_SPLIT_LOCK)) {
	inject #AC back to guest
} else {
	if (guest_alignment_check_enabled() || guest_sld_on())
		inject #AC back to guest
}

BTW, there is an issue in my original patch that guest_sld_on() should 
be checked at last.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ