From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH] Synchronize cpu state with kernel before poking into registers. Date: Thu, 16 Feb 2012 11:12:51 +0200 Message-ID: <20120216091251.GD19771@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, mtosatti@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42754 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932263Ab2BPJMx (ORCPT ); Thu, 16 Feb 2012 04:12:53 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1G9CqVu014675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Feb 2012 04:12:53 -0500 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Call to kvm_cpu_synchronize_state() is missing. kvm_arch_stop_on_emulation_error may look at outdated registers here. Signed-off-by: Gleb Natapov diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 7079e87..51d0ae7 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -2020,6 +2020,7 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run) bool kvm_arch_stop_on_emulation_error(CPUState *env) { + kvm_cpu_synchronize_state(env); return !(env->cr[0] & CR0_PE_MASK) || ((env->segs[R_CS].selector & 3) != 3); } -- Gleb.