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] [day] [month] [year] [list]
Message-ID: <3cd45ce5-fde0-eda1-9797-66d7d5212bd9@redhat.com>
Date:   Thu, 25 Feb 2021 11:15:20 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: SVM: Fix nested VM-Exit on #GP interception handling

On 24/02/21 01:56, Sean Christopherson wrote:
> Fix the interpreation of nested_svm_vmexit()'s return value when
> synthesizing a nested VM-Exit after intercepting an SVM instruction while
> L2 was running.  The helper returns '0' on success, whereas a return
> value of '0' in the exit handler path means "exit to userspace".  The
> incorrect return value causes KVM to exit to userspace without filling
> the run state, e.g. QEMU logs "KVM: unknown exit, hardware reason 0".
> 
> Fixes: 14c2bf81fcd2 ("KVM: SVM: Fix #GP handling for doubly-nested virtualization")
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
>   arch/x86/kvm/svm/svm.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 14e41dddc7eb..c4f2f2f6b945 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -2200,13 +2200,18 @@ static int emulate_svm_instr(struct kvm_vcpu *vcpu, int opcode)
>   		[SVM_INSTR_VMSAVE] = vmsave_interception,
>   	};
>   	struct vcpu_svm *svm = to_svm(vcpu);
> +	int ret;
>   
>   	if (is_guest_mode(vcpu)) {
>   		svm->vmcb->control.exit_code = guest_mode_exit_codes[opcode];
>   		svm->vmcb->control.exit_info_1 = 0;
>   		svm->vmcb->control.exit_info_2 = 0;
>   
> -		return nested_svm_vmexit(svm);
> +		/* Returns '1' or -errno on failure, '0' on success. */
> +		ret = nested_svm_vmexit(svm);
> +		if (ret)
> +			return ret;
> +		return 1;
>   	}
>   	return svm_instr_handlers[opcode](vcpu);
>   }
> 

Queued, thanks.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ