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

[Xen-devel] [PATCH for-4.11] x86/cacheattr: fix mtrr_pat_not_equal



The function is supposed to return whether the MTRR and PAT state of
two CPUs match. Currently this is not properly done because the test
for the deftype and the enable bits required both the deftype and the
enable bits to be different, while just one of those fields being
different can already cause the MTRR states on the vCPU to not match.

Fix this by changing the AND into an OR instead, so that either the
deftype or the enabled bits being different will cause the function to
return mismatching state.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
---
This is a bugfix and should go into 4.11
---
 xen/arch/x86/hvm/mtrr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index b721c6330f..3e0435c503 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -492,9 +492,8 @@ bool_t mtrr_pat_not_equal(struct vcpu *vd, struct vcpu *vs)
     if ( res )
         return 1;
 
-    /* Test default type MSR. */
-    if ( (md->def_type != ms->def_type)
-            && (md->enabled != ms->enabled) )
+    /* Test default type MSR and the enable bits. */
+    if ( (md->def_type != ms->def_type) || (md->enabled != ms->enabled) )
         return 1;
 
     /* Test PAT. */
-- 
2.17.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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