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

Re: [Xen-devel] [Patch] cmpxchg emulation returns wrong ZF



On 06/08/2009 07:49, "Juergen Gross" <juergen.gross@xxxxxxxxxxxxxx> wrote:

> attached patch corrects a bug in cmpxchg emulation in the hypervisor.
> 
> BS2000 running as HVM-domain on 4 vcpus (no HAP) hit an error due to this bug
> after several days.

You'll have to give more details as I don't see the bug that this patch
fixes. Changeset comment says "ops->cmpxchg might return
X86EMUL_CMPXCHG_FAILED if the addressed memory location changed after
checking the old contents. In this case ZF was not changed and could remain
1 instead of being set to 0." Now, firstly the patch does not directly alter
ZF when X86EMUL_CMPXCHG_FAILED. Secondly, the X86EMUL_CMPXCHG_FAILED is
supposed to be safe to propagate to the caller of x86_emulate(), who can
then choose to retry. Most callers implicitly retry by treating similar to
X86EMUL_OKAY -- returning to guest context where the instruction gets
reattempted due to EIP not having changed. That last point is crucial to the
correctness of course: Indeed we are not messing with EFLAGS.ZF on that
return code, but then we are not updating *any* state (including the program
counter) so it is supposed to be as if the instruction was not executed
(which is obviously correct, since it wasn't).

 -- Keir



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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