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: <57597778-836c-7bac-7f1d-bcdae0cd6ac4@intel.com>
Date:   Wed, 22 Sep 2021 18:32:22 +0800
From:   Xiaoyao Li <xiaoyao.li@...el.com>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Hao Xiang <hao.xiang@...ux.alibaba.com>, kvm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, chenyi.qiang@...el.com,
        shannon.zhao@...ux.alibaba.com,
        Sean Christopherson <seanjc@...gle.com>
Subject: Re: [PATCH] KVM: VMX: Check if bus lock vmexit was preempted

On 9/22/2021 6:02 PM, Paolo Bonzini wrote:
> On 18/09/21 13:30, Hao Xiang wrote:
>> exit_reason.bus_lock_detected is not only set when bus lock VM exit
>> was preempted, in fact, this bit is always set if bus locks are
>> detected no matter what the exit_reason.basic is.
>>
>> So the bus_lock_vmexit handling in vmx_handle_exit should be duplicated
>> when exit_reason.basic is EXIT_REASON_BUS_LOCK(74). We can avoid it by
>> checking if bus lock vmexit was preempted in vmx_handle_exit.
> 
> I don't understand, does this mean that bus_lock_detected=1 if 
> basic=EXIT_REASON_BUS_LOCK?  If so, can we instead replace the contents 
> of handle_bus_lock_vmexit with
> 
>      /* Do nothing and let vmx_handle_exit exit to userspace.  */
>      WARN_ON(!to_vmx(vcpu)->exit_reason.bus_lock_detected);
>      return 0;
> 
> ?
> 
> That would be doable only if this is architectural behavior and not a 
> processor erratum, of course.

EXIT_REASON.bus_lock_detected may or may not be set when exit reason == 
EXIT_REASON_BUS_LOCK. Intel will update ISE or SDM to state it.

Maybe we can do below in handle_bus_lock_vmexit handler:

	if (!to_vmx(vcpu)->exit_reason.bus_lock_detected)
		to_vmx(vcpu)->exit_reason.bus_lock_detected = 1;

But is manually changing the hardware reported value for software 
purpose a good thing?


> Thanks,
> 
> Paolo
> 
>> Signed-off-by: Hao Xiang <hao.xiang@...ux.alibaba.com>
>> ---
>>   arch/x86/kvm/vmx/vmx.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>> index 0c2c0d5..5ddf1df 100644
>> --- a/arch/x86/kvm/vmx/vmx.c
>> +++ b/arch/x86/kvm/vmx/vmx.c
>> @@ -6054,7 +6054,8 @@ static int vmx_handle_exit(struct kvm_vcpu 
>> *vcpu, fastpath_t exit_fastpath)
>>        * still need to exit to user space when bus lock detected to 
>> inform
>>        * that there is a bus lock in guest.
>>        */
>> -    if (to_vmx(vcpu)->exit_reason.bus_lock_detected) {
>> +    if (to_vmx(vcpu)->exit_reason.bus_lock_detected &&
>> +            to_vmx(vcpu)->exit_reason.basic != EXIT_REASON_BUS_LOCK) {
>>           if (ret > 0)
>>               vcpu->run->exit_reason = KVM_EXIT_X86_BUS_LOCK;
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ