hvmemul_cmpxchg() sets the read emulation context in p_new instead of p_old, which is inconsistent (and wrong). We are now setting p_old (even though it's unused) and adding a comment explaining the change.
Suggested-by: Jan Beulich <jbeul...@suse.com> Signed-off-by: Razvan Cojocaru <rcojoc...@bitdefender.com> --- xen/arch/x86/hvm/emulate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index d759d3f..0cbb16e 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1031,13 +1031,17 @@ static int hvmemul_cmpxchg( if ( unlikely(hvmemul_ctxt->set_context) ) { - int rc = set_context_data(p_new, bytes); + int rc = set_context_data(p_old, bytes); if ( rc != X86EMUL_OKAY ) return rc; } - /* Fix this in case the guest is really relying on r-m-w atomicity. */ + /* + * Fix this in case the guest is really relying on r-m-w atomicity. + * Please note that while the set_context code is provided here for + * consistency, p_old is unused. + */ return hvmemul_write(seg, offset, p_new, bytes, ctxt); } -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel