Re: [PATCH] KVM: SVM: Workaround errata#1096 (insn_len maybe zero on SMAP violation)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2/12/19 9:06 AM, Paolo Bonzini wrote:
> On 12/02/19 15:44, Singh, Brijesh wrote:
>> -	if (unlikely(insn && !insn_len))
>> -		return 1;
>> +	if (unlikely(insn && !insn_len)) {
>> +		if (!kvm_x86_ops->emulate_instruction_possible(vcpu))
>> +			return 1;
>> +	}
> 
> Are the instruction bytes valid, that is can we just ignore insn_len and
> use the bytes but not the length?  That would work for SEV too.
> 


The instruction bytes are not valid so we will not able to workaround
for the SEV.


> Paolo
> 
>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>> index 95d618045001..6767bad8367e 100644
>> --- a/arch/x86/kvm/vmx/vmx.c
>> +++ b/arch/x86/kvm/vmx/vmx.c
>> @@ -7530,6 +7530,11 @@ static int enable_smi_window(struct kvm_vcpu *vcpu)
>>   	return 0;
>>   }
>>   
>> +static bool emulate_instruction_possible(struct kvm_vcpu *vcpu)
>> +{
>> +	return 1;
> 
> This should be "return 0;" to keep previous behavior.
> 
Sure, I will fix in v2.


>> +}
>> +
>>   static __init int hardware_setup(void)
>>   {
>>   	unsigned long host_bndcfgs;
>> @@ -7832,6 +7837,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
>>   	.set_nested_state = NULL,
>>   	.get_vmcs12_pages = NULL,
>>   	.nested_enable_evmcs = NULL,
>> +	.emulate_instruction_possible = emulate_instruction_possible,
>>   };
>>   
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux