Re: [PATCH v4 2/7] x86: kvm: svm: propagate errors from skip_emulated_instruction()

2019-08-15 Thread Vitaly Kuznetsov
Sean Christopherson writes: > On Wed, Aug 14, 2019 at 11:34:52AM +0200, Vitaly Kuznetsov wrote: >> Sean Christopherson writes: >> >> > x86_emulate_instruction() doesn't set vcpu->run->exit_reason when emulation >> > fails with EMULTYPE_SKIP, i.e. this will exit to userspace with garbage in >> >

Re: [PATCH v4 2/7] x86: kvm: svm: propagate errors from skip_emulated_instruction()

2019-08-14 Thread Sean Christopherson
On Wed, Aug 14, 2019 at 11:34:52AM +0200, Vitaly Kuznetsov wrote: > Sean Christopherson writes: > > > x86_emulate_instruction() doesn't set vcpu->run->exit_reason when emulation > > fails with EMULTYPE_SKIP, i.e. this will exit to userspace with garbage in > > the exit_reason. > > Oh, nice

Re: [PATCH v4 2/7] x86: kvm: svm: propagate errors from skip_emulated_instruction()

2019-08-14 Thread Vitaly Kuznetsov
Sean Christopherson writes: > On Tue, Aug 13, 2019 at 03:53:30PM +0200, Vitaly Kuznetsov wrote: >> @@ -3899,20 +3898,25 @@ static int task_switch_interception(struct vcpu_svm >> *svm) >> if (reason != TASK_SWITCH_GATE || >> int_type == SVM_EXITINTINFO_TYPE_SOFT || >>

Re: [PATCH v4 2/7] x86: kvm: svm: propagate errors from skip_emulated_instruction()

2019-08-13 Thread Sean Christopherson
On Tue, Aug 13, 2019 at 03:53:30PM +0200, Vitaly Kuznetsov wrote: > @@ -3899,20 +3898,25 @@ static int task_switch_interception(struct vcpu_svm > *svm) > if (reason != TASK_SWITCH_GATE || > int_type == SVM_EXITINTINFO_TYPE_SOFT || > (int_type ==

[PATCH v4 2/7] x86: kvm: svm: propagate errors from skip_emulated_instruction()

2019-08-13 Thread Vitaly Kuznetsov
On AMD, kvm_x86_ops->skip_emulated_instruction(vcpu) can, in theory, fail: in !nrips case we call kvm_emulate_instruction(EMULTYPE_SKIP). Currently, we only do printk(KERN_DEBUG) when this happens and this is not ideal. Propagate the error up the stack. On VMX, skip_emulated_instruction() doesn't