bug in PT write emulation
I think the below fix is correct, though as I'm far from comfortable with this code I'd like some comments first...
'val' is the unmodified pte value written by the guest. We need to use nl1e instead, which has done the needed PAGE_GLOBAL etc. modifications.
cheers,
john
# HG changeset patch
# User [email protected]
# Date 1192664022 25200
# Node ID d2eed7e51be31880f04033d1241861602d3628bb # Parent a6b52e05bcd026a7d378fff130b90d6eda62209a
xen/arch/x86/mm.c +1 -1
@@ -3204,7 +3204,7 @@ static int ptwr_emulated_update(if (shadow_mode_enabled (d) )shadow_lock (d); ol1e =l1e_from_intpte (old); -if (cmpxchg ((intpte_t *)pl1e, old, val) != old ) +if (cmpxchg ((intpte_t *)pl1e, old,l1e_get_intpte (nl1e)) != old ) {if (shadow_mode_enabled (d) )shadow_unlock (d);
You could be right, although what version of Xen is that code snippet from? Xen 3.1 and Xen unstable both look quite different.
-- Keir
Quoted 33 lines · John Levon
I think the below fix is correct, though as I'm far from comfortable with this code I'd like some comments first...
'val' is the unmodified pte value written by the guest. We need to use nl1e instead, which has done the needed
PAGE_GLOBALetc. modifications.cheers,
john# HG changeset patch
# User [email protected]
# Date 1192664022 25200
# Node IDd2eed7e51be31880f04033d1241861602d3628bb# Parenta6b52e05bcd026a7d378fff130b90d6eda62209axen/arch/x86/mm.c +1
-1@@ -3204,7 +3204,7 @@ static int ptwr_emulated_update(if (shadow_mode_enabled (d) )shadow_lock (d); ol1e =l1e_from_intpte (old); -if (cmpxchg ((intpte_t *)pl1e, old, val) != old ) +if (cmpxchg ((intpte_t *)pl1e, old,l1e_get_intpte (nl1e)) != old ) {if (shadow_mode_enabled (d) )shadow_unlock (d);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Keir Fraser
You could be right, although what version of Xen is that code snippet from? Xen 3.1 and Xen unstable both look quite different.
3.0.4. I just checked xen-unstable (sorry) - it has the same bug:
3377 adjust_guest_l1e(nl1e, d);
3378
...
3382 if ( do_cmpxchg )
3383 {
...
3388 okay = paging_cmpxchg_guest_entry(v, &l1e_get_intpte(*pl1e),
3389 &t, val, _mfn(mfn));
"val" not "nl1e"
I suspect this is hurting performance for us.
cheers,
john
PS slightly related note - is _PAGE_GUEST_KERNEL part of the ABI?
Quoted 1 line · John Levon
3.0.4. I just checked xen-unstable (sorry) - it has the same bug:
Yes, now fixed.
Quoted 1 line
PS slightly related note - is
_PAGE_GUEST_KERNELpart of the ABI?
Yes, rather unavoidably! Certainly we don't intend to randomly change which pte bit we use for this purpose.
-- Keir