issues with movnti emulation
We've got reports of that change causing HVM data corruption issues. While I can't see what's wrong with the patch, I'd suggest at least reverting it from the 3.3 tree (which is what our code is based upon) for the time being.
Jan
I think the issue is that I did a bad backport to 3.3. The 'case 0xc3' should be under twobyte_special_insn rather than twobyte_insn, right? The two separate paths got merged into one in xen-unstable.
Of course this data corruption ought only to happen in cases where we'd previously have failed an mmio emulation (and hence probably killed the guest kernel?).
-- Keir
Quoted 7 lines · Jan Beulich
We've got reports of that change causing HVM data corruption issues. While I can't see what's wrong with the patch, I'd suggest at least reverting it from
the 3.3 tree (which is what our code is based upon) for the time being.Jan
Quoted 7 lines · Keir Fraser
I think the issue is that I did a bad backport to 3.3. The 'case
0xc3' should be undertwobyte_special_insnrather thantwobyte_insn, right? The two separate paths got merged into one in xen-unstable.Of course this data corruption ought only to happen in cases where we'd previously have failed an mmio emulation (and hence probably killed the guest kernel?).
A more likely culprit is that some OSes use movnti to zero pages that used to be pagetables; when we couldn't emulate it we just (correctly) unshadowed those pages.
Cheers,
Tim.
Quoted 19 lines
-- Keir
Quoted 7 lines · Jan Beulich
We've got reports of that change causing HVM data corruption issues. While I can't see what's wrong with the patch, I'd suggest at least reverting it from
the 3.3 tree (which is what our code is based upon) for the time being.Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Quoted 5 lines · Tim Deegan
Quoted 4 lines · Keir Fraser
I think the issue is that I did a bad backport to 3.3. The 'case
0xc3' should be undertwobyte_special_insnrather thantwobyte_insn, right? The two separate paths got merged into one in xen-unstable.
Quoted 7 lines
Quoted 3 lines
Of course this data corruption ought only to happen in cases where we'd previously have failed an mmio emulation (and hence probably killed the guest kernel?).
A more likely culprit is that some OSes use movnti to zero pages that used to be pagetables; when we couldn't emulate it we just (correctly) unshadowed those pages.
Yes, you're probably right. I wonder if we are relying on emulation failures to inform unshadowing at all often? We might have to revisit constraining x86_emulate() when called by shadow code, do you think?
-- Keir
Quoted 3 lines · Keir Fraser
I think the issue is that I did a bad backport to 3.3. The 'case
0xc3' should be undertwobyte_special_insnrather thantwobyte_insn, right? The two separate paths got merged into one in xen-unstable.
The other way round, but yes, this seems to have caused the corruption.
Kevin
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 20.11.08 18:13 >>>
I think the issue is that I did a bad backport to 3.3. The 'case
0xc3' should be undertwobyte_special_insnrather thantwobyte_insn, right? The two separate paths got merged into one in xen-unstable.
Oh, indeed - if you mean it the other way around.
Quoted 3 lines
Of course this data corruption ought only to happen in cases where we'd previously have failed an mmio emulation (and hence probably killed the guest kernel?).
Yes, we previously saw emulation failure messages. The guest wasn't killed because of that, however. I have to admit it's been a while since I last looked at mmio emulation - is it eagerly trying to emulate successive instructions, and return to native execution when emulation failed? If not, I could neither explain why only some data got corrupted here, nor why the guest didn't get killed.
Jan
Quoted 10 lines · Jan Beulich
Quoted 3 lines
Of course this data corruption ought only to happen in cases where we'd previously have failed an mmio emulation (and hence probably killed the guest kernel?).
Yes, we previously saw emulation failure messages. The guest wasn't killed because of that, however. I have to admit it's been a while since I last looked at mmio emulation - is it eagerly trying to emulate successive instructions, and return to native execution when emulation failed? If not, I could neither explain why only some data got corrupted here, nor why the guest didn't get killed.
TimD had the correct explanation -- page-table pages getting recycled via Windows' page scrubber.
-- Keir
Quoted 3 lines · Keir Fraser
Yes, you're probably right. I wonder if we are relying on emulation failures to inform unshadowing at all often? We might have to revisit constraining
x86_emulate()when called by shadow code, do you think?
Yes, I think it would probably be worth looking at that.
Tim.
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Gianluca Guida <[email protected]> 24.11.08 17:18 >>>
Quoted 6 lines · Tim Deegan
Quoted 3 lines · Keir Fraser
Yes, you're probably right. I wonder if we are relying on emulation failures to inform unshadowing at all often? We might have to revisit constraining
x86_emulate()when called by shadow code, do you think?Yes, I think it would probably be worth looking at that.
In what kind of guest/workloads we were experiencing this corruption?
SLE11 installation.
Jan
Quoted 6 lines · Tim Deegan
Quoted 3 lines · Keir Fraser
Yes, you're probably right. I wonder if we are relying on emulation failures to inform unshadowing at all often? We might have to revisit constraining
x86_emulate()when called by shadow code, do you think?Yes, I think it would probably be worth looking at that.
In what kind of guest/workloads we were experiencing this corruption?
Thanks,
Gianluca
Quoted 3 lines · Keir Fraser
I think the issue is that I did a bad backport to 3.3. The 'case
0xc3' should be undertwobyte_special_insnrather thantwobyte_insn, right? The two separate paths got merged into one in xen-unstable.
This seems actually to be the case. The actual move from src.val to dst.val never happened with the current patch, and this made movnti to write in memory the original dst.val value, leading to memory corruption.
By moving the switch case into twobyte_insn the problem goes away.
Gianluca