[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86emul: fix FXRSTOR test for most AMD CPUs



commit f97f99c8d88ebc108f6adc3ba74e87d53ba57c70
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Jul 6 17:14:24 2020 +0200
Commit:     Wei Liu <wl@xxxxxxx>
CommitDate: Mon Jul 6 18:12:22 2020 +0000

    x86emul: fix FXRSTOR test for most AMD CPUs
    
    AMD CPUs that we classify as X86_BUG_FPU_PTRS don't touch the selector/
    offset portion of the save image during FXSAVE unless an unmasked
    exception is pending. Hence the selector zapping done between the
    initial FXSAVE and the emulated FXRSTOR needs to be mirrored onto the
    second FXSAVE, output of which gets fed into memcmp() to compare with
    the input image.
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Tested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Release-acked-by: Paul Durrant <paul@xxxxxxx>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c 
b/tools/tests/x86_emulator/test_x86_emulator.c
index e7de37eaef..4b01fa8b8d 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2577,6 +2577,7 @@ int main(int argc, char **argv)
         regs.ecx = (unsigned long)(res + 0x81);
         rc = x86_emulate(&ctxt, &emulops);
         asm volatile ( "fxsave %0" : "=m" (res[0x100]) :: "memory" );
+        zap_xfpsel(&res[0x100]);
         if ( (rc != X86EMUL_OKAY) ||
              memcmp(res + 0x100, res + 0x80, 0x200) ||
              (regs.eip != (unsigned long)&instr[4]) )
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.