All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] nVMX: Check EXIT_QUALIFICATION on VM-Enter failures due to bad guest state
Date: Fri, 8 May 2020 16:37:23 -0700	[thread overview]
Message-ID: <20200508233723.GW27052@linux.intel.com> (raw)
In-Reply-To: <20200424174025.1379-1-sean.j.christopherson@intel.com>

On Fri, Apr 24, 2020 at 10:40:25AM -0700, Sean Christopherson wrote:
> Assert that vmcs.EXIT_QUALIFICATION contains the correct failure code on
> failed VM-Enter due to invalid guest state.  Hardcode the expected code
> to the default code, '0', rather than passing in the expected code to
> minimize churn and boilerplate code, which works for all existing tests.
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...except for atomic_switch_overflow_msrs_test.  I'll get a fix sent out
next week.

> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  x86/vmx.h       | 7 +++++++
>  x86/vmx_tests.c | 3 ++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/x86/vmx.h b/x86/vmx.h
> index 2e28ecb..08b354d 100644
> --- a/x86/vmx.h
> +++ b/x86/vmx.h
> @@ -521,6 +521,13 @@ enum vm_instruction_error_number {
>  	VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID = 28,
>  };
>  
> +enum vm_entry_failure_code {
> +	ENTRY_FAIL_DEFAULT		= 0,
> +	ENTRY_FAIL_PDPTE		= 2,
> +	ENTRY_FAIL_NMI			= 3,
> +	ENTRY_FAIL_VMCS_LINK_PTR	= 4,
> +};
> +
>  #define SAVE_GPR				\
>  	"xchg %rax, regs\n\t"			\
>  	"xchg %rcx, regs+0x8\n\t"		\
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 4a3c56b..f5a646f 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -5255,7 +5255,8 @@ static void test_guest_state(const char *test, bool xfail, u64 field,
>  
>  	report(result.exit_reason.failed_vmentry == xfail &&
>  	       ((xfail && result.exit_reason.basic == VMX_FAIL_STATE) ||
> -	        (!xfail && result.exit_reason.basic == VMX_VMCALL)),
> +	        (!xfail && result.exit_reason.basic == VMX_VMCALL)) &&
> +		(!xfail || vmcs_read(EXI_QUALIFICATION) == ENTRY_FAIL_DEFAULT),
>  	        "%s, %s %lx", test, field_name, field);
>  
>  	if (!result.exit_reason.failed_vmentry)
> -- 
> 2.26.0
> 

      parent reply	other threads:[~2020-05-08 23:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 17:40 [kvm-unit-tests PATCH] nVMX: Check EXIT_QUALIFICATION on VM-Enter failures due to bad guest state Sean Christopherson
2020-05-04 16:34 ` Paolo Bonzini
2020-05-08 23:37 ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200508233723.GW27052@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.