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 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.

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.

> +}
> +
>  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