diff mbox

[kvm-unit-tests] x86: fix access.flat on non-SMEP machines

Message ID 1505510552-22114-1-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini Sept. 15, 2017, 9:22 p.m. UTC
We need to restore PDPE.U=1, similar to what the tests do after printing
the "Set SMEP in CR4 - expect #GP: FAIL" message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 x86/access.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/x86/access.c b/x86/access.c
index a0c19dc..11f561b 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -207,7 +207,7 @@  unsigned set_cr4_smep(int smep)
     if (smep)
         ptl2[2] &= ~PT_USER_MASK;
     r = write_cr4_checking(cr4);
-    if (!smep)
+    if (r || !smep)
         ptl2[2] |= PT_USER_MASK;
     return r;
 }