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: <ee8c5eb6-9e3d-620b-d51f-bf0534a05d43@oracle.com>
Date:   Thu, 27 Feb 2020 12:08:55 -0800
From:   Krish Sadhukhan <krish.sadhukhan@...cle.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>,
        Paolo Bonzini <pbonzini@...hat.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, Xiaoyao Li <xiaoyao.li@...el.com>
Subject: Re: [PATCH] KVM: nVMX: Consult only the "basic" exit reason when
 routing nested exit


On 2/27/20 9:44 AM, Sean Christopherson wrote:
> Consult only the basic exit reason, i.e. bits 15:0 of vmcs.EXIT_REASON,
> when determining whether a nested VM-Exit should be reflected into L1 or
> handled by KVM in L0.
>
> For better or worse, the switch statement in nested_vmx_exit_reflected()
> currently defaults to "true", i.e. reflects any nested VM-Exit without
> dedicated logic.  Because the case statements only contain the basic
> exit reason, any VM-Exit with modifier bits set will be reflected to L1,
> even if KVM intended to handle it in L0.
>
> Practically speaking, this only affects EXIT_REASON_MCE_DURING_VMENTRY,
> i.e. a #MC that occurs on nested VM-Enter would be incorrectly routed to
> L1, as "failed VM-Entry" is the only modifier that KVM can currently
> encounter.  The SMM modifiers will never be generated as KVM doesn't
> support/employ a SMI Transfer Monitor.  Ditto for "exit from enclave",
> as KVM doesn't yet support virtualizing SGX, i.e. it's impossible to
> enter an enclave in a KVM guest (L1 or L2).


It seems nested_vmx_exit_reflected() deals only with the basic exit 
reason. If it doesn't need anything beyond bits 15:0, may be 
vmx_handle_exit() can pass just the base exit reason ?

>
> Fixes: 644d711aa0e1 ("KVM: nVMX: Deciding if L0 or L1 should handle an L2 exit")
> Cc: Jim Mattson <jmattson@...gle.com>
> Cc: Xiaoyao Li <xiaoyao.li@...el.com>
> Cc: stable@...r.kernel.org
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
>   arch/x86/kvm/vmx/nested.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 0946122a8d3b..127065bbde2c 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -5554,7 +5554,7 @@ bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason)
>   				vmcs_read32(VM_EXIT_INTR_ERROR_CODE),
>   				KVM_ISA_VMX);
>   
> -	switch (exit_reason) {
> +	switch ((u16)exit_reason) {
>   	case EXIT_REASON_EXCEPTION_NMI:
>   		if (is_nmi(intr_info))
>   			return false;
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@...cle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ