qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH 09/12] kvm: validate context for kvm cpu get/put operations
Date: Wed, 12 May 2010 18:25:03 -0300	[thread overview]
Message-ID: <dbaa07c404d05676df8a081e60b6e66344eafc51.1273699506.git.mtosatti@redhat.com> (raw)
In-Reply-To: <cover.1273699506.git.mtosatti@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

Validate that KVM vcpu state is only read/written from cpu thread itself
or that cpu is stopped.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 target-i386/kvm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

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;
-- 
1.6.6.1

  parent reply	other threads:[~2010-05-13  3:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 21:24 [Qemu-devel] [PATCH 00/12] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-05-12 21:24 ` [Qemu-devel] [PATCH 01/12] Fix -mem-path with hugetlbfs Marcelo Tosatti
2010-05-12 21:24 ` [Qemu-devel] [PATCH 02/12] kvm: set cpu_single_env around KVM_RUN ioctl Marcelo Tosatti
2010-05-12 21:24 ` [Qemu-devel] [PATCH 03/12] make SIG_IPI to tcg vcpu thread reliable Marcelo Tosatti
2010-05-12 21:24 ` [Qemu-devel] [PATCH 04/12] standardize on qemu_cpu_kick for signalling cpu thread(s) Marcelo Tosatti
2010-05-12 21:24 ` [Qemu-devel] [PATCH 05/12] port qemu-kvm's on_vcpu code Marcelo Tosatti
2010-05-12 21:25 ` [Qemu-devel] [PATCH 06/12] kvm: synchronize state from cpu context Marcelo Tosatti
2010-05-12 21:25 ` [Qemu-devel] [PATCH 07/12] add cpu_is_stopped helper Marcelo Tosatti
2010-05-12 21:25 ` [Qemu-devel] [PATCH 08/12] move stop/stopped CPU_COMMON fields after area zeroed by reset Marcelo Tosatti
2010-05-12 21:25 ` Marcelo Tosatti [this message]
2010-05-12 21:25 ` [Qemu-devel] [PATCH 10/12] kvm: enable smp > 1 Marcelo Tosatti
2010-05-14 14:06   ` [Qemu-devel] " Alexander Graf
2010-05-14 15:48     ` Avi Kivity
2010-05-14 15:49       ` Alexander Graf
2010-05-14 15:54         ` Jan Kiszka
2010-05-14 15:58           ` Alexander Graf
2010-05-19  9:57           ` Udo Lembke
2010-05-19 16:21             ` Avi Kivity
2010-05-19 20:02               ` Udo Lembke
2010-05-20  6:12                 ` Avi Kivity
2010-05-20  7:01                   ` Udo Lembke
2010-05-12 21:25 ` [Qemu-devel] [PATCH 11/12] Do not stop VM if emulation failed in userspace Marcelo Tosatti
2010-05-12 21:25 ` [Qemu-devel] [PATCH 12/12] kvm: fix 80000001.EDX supported bit filtering Marcelo Tosatti
2010-05-17 18:10 ` [Qemu-devel] [PATCH 00/12] [PULL] qemu-kvm.git uq/master queue Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbaa07c404d05676df8a081e60b6e66344eafc51.1273699506.git.mtosatti@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).