From patchwork Wed May 12 21:25:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 99113 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CLRLHI029210 for ; Wed, 12 May 2010 21:27:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757961Ab0ELV1U (ORCPT ); Wed, 12 May 2010 17:27:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11938 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757943Ab0ELV1N (ORCPT ); Wed, 12 May 2010 17:27:13 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR20J011642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 May 2010 17:27:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR191018159; Wed, 12 May 2010 17:27:01 -0400 Received: from amt.cnet (vpn2-10-158.ams2.redhat.com [10.36.10.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLQxBJ021848; Wed, 12 May 2010 17:27:00 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id CF74D65607E; Wed, 12 May 2010 18:26:18 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o4CLQDk2028660; Wed, 12 May 2010 18:26:13 -0300 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , Avi Kivity Subject: [PATCH 09/12] kvm: validate context for kvm cpu get/put operations Date: Wed, 12 May 2010 18:25:03 -0300 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 21:27:23 +0000 (UTC) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index f73b47b..c9ec72e 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -949,6 +949,8 @@ int kvm_arch_put_registers(CPUState *env, int level) { int ret; + assert(cpu_is_stopped(env) || qemu_cpu_self(env)); + ret = kvm_getput_regs(env, 1); if (ret < 0) return ret; @@ -991,6 +993,8 @@ int kvm_arch_get_registers(CPUState *env) { int ret; + assert(cpu_is_stopped(env) || qemu_cpu_self(env)); + ret = kvm_getput_regs(env, 0); if (ret < 0) return ret;