diff mbox series

[kvm-unit-tests] x86: VMX: INVEPT after modifying PA mapping in ept_untwiddle

Message ID 20190828082900.88609-1-oupton@google.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] x86: VMX: INVEPT after modifying PA mapping in ept_untwiddle | expand

Commit Message

Oliver Upton Aug. 28, 2019, 8:29 a.m. UTC
ept_untwiddle modifies a PA mapping in the EPT paging structure.
According to the SDM 28.3.3.4, "Software should use the INVEPT
instruction with the "single-context" INVEPT type after making any of
the following changes to an EPT paging-structure entry ... Changing
the physical address in bits 51:12".

Suggested-by: Peter Shier <pshier@google.com>
Signed-off-by: Oliver Upton <oupton@google.com>
---
 x86/vmx_tests.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Bonzini Sept. 11, 2019, 3:45 p.m. UTC | #1
On 28/08/19 10:29, Oliver Upton wrote:
> ept_untwiddle modifies a PA mapping in the EPT paging structure.
> According to the SDM 28.3.3.4, "Software should use the INVEPT
> instruction with the "single-context" INVEPT type after making any of
> the following changes to an EPT paging-structure entry ... Changing
> the physical address in bits 51:12".
> 
> Suggested-by: Peter Shier <pshier@google.com>
> Signed-off-by: Oliver Upton <oupton@google.com>
> ---
>  x86/vmx_tests.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 8ad26741277f..94be937da41d 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -2376,6 +2376,7 @@ static unsigned long ept_twiddle(unsigned long gpa, bool mkhuge, int level,
>  static void ept_untwiddle(unsigned long gpa, int level, unsigned long orig_pte)
>  {
>  	set_ept_pte(pml4, gpa, level, orig_pte);
> +	ept_sync(INVEPT_SINGLE, eptp);
>  }
>  
>  static void do_ept_violation(bool leaf, enum ept_access_op op,
> 

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 8ad26741277f..94be937da41d 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -2376,6 +2376,7 @@  static unsigned long ept_twiddle(unsigned long gpa, bool mkhuge, int level,
 static void ept_untwiddle(unsigned long gpa, int level, unsigned long orig_pte)
 {
 	set_ept_pte(pml4, gpa, level, orig_pte);
+	ept_sync(INVEPT_SINGLE, eptp);
 }
 
 static void do_ept_violation(bool leaf, enum ept_access_op op,