qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Binun <binun@cs.bgu.ac.il>
Cc: yagel@cs.bgu.ac.il, kahilm@post.bgu.ac.il,
	Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, boaz.menuhin@gmail.com,
	markbl@post.bgu.ac.il
Subject: Re: [Qemu-devel] different IDTs of the same VCPU
Date: Thu, 13 Mar 2014 16:15:56 +0100	[thread overview]
Message-ID: <5321CBAC.20104@redhat.com> (raw)
In-Reply-To: <201403131259.s2DCxtIT011218@indigo.cs.bgu.ac.il>

Il 13/03/2014 13:59, Alexander Binun ha scritto:
> Dear Friends,
>
>    Thanks for your assistance!
>
> We would like to ask you a question about the KVM internals.
>
> Our module includes a timer which (once in every second) fetches the IDT value of every online VCPU in the system using the kvm_x86_ops->get_idt ; the code looks like:
>
>   struct kvm_vcpu *curr_vcpu;
>   struct desc_ptr dt;
>
>   list_for_each_entry(kvm, vms_list, vm_list)
>   {
>     for (i = 0; i < kvm->online_vcpus.counter; i++)
>        {
>        curr_vcpu = kvm->vcpus[i];
>        kvm_x86_ops->get_idt(curr_vcpu, &dt);
>     }
>   }
>
> We have noticed that get_idt returns DIFFERENT values for the same
> VCPU (i.e. for the same value of i that refers to a given VCPU). We
> cannot understand this issue; could you explain ?
>
> It is very strange since nobody changes the IDT value (as , for example, rootkits do).

At the very least, running nested virtualization would lead to different 
IDT values.

But more simply, on Intel you can hardly do anything with kvm_x86_ops or 
kvm_vcpu except on the same physical CPU that is in vcpu->cpu.  The 
state is not in memory, it is cached inside the physical CPU.

There is no easy solution to this without modifying KVM.  You can add a 
request bit to KVM's vcpu->requests field, kick the vcpu and do the 
check in vcpu_enter_guest.

Paolo

  reply	other threads:[~2014-03-13 15:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07 14:47 [Qemu-devel] sniffing traffic between VMs Alexander Binun
2013-10-10  9:02 ` Stefan Hajnoczi
2013-10-10 11:00   ` [Qemu-devel] kvm binary is deprecated Alexander Binun
2013-10-11  9:05     ` Stefan Hajnoczi
2013-10-12 14:45       ` Alexander Binun
2013-10-14  9:12         ` Stefan Hajnoczi
2013-10-14 10:36           ` Alexander Binun
2013-10-14 14:16             ` Stefan Hajnoczi
2013-10-24  9:23               ` [Qemu-devel] kvm binary is deprecated - solved! Alexander Binun
2013-10-24  9:49                 ` Stefan Hajnoczi
2013-10-24  9:54                   ` [Qemu-devel] observing VM actions Alexander Binun
2013-12-18 11:53           ` [Qemu-devel] sniffing traffic between virtual machines Alexander Binun
2013-12-19  9:05             ` Stefan Hajnoczi
2014-03-05 16:35               ` [Qemu-devel] kill /destroy a VM - help Alexander Binun
2014-03-06 10:22                 ` Stefan Hajnoczi
2014-03-06 10:31                   ` Alexander Binun
2014-03-06 11:28                     ` Paolo Bonzini
2014-03-06 15:54                       ` [Qemu-devel] kill /destroy a VM - still hangs! Alexander Binun
2014-03-09 15:40                       ` [Qemu-devel] trying to kill a VM Alexander Binun
2014-03-13 12:59                       ` [Qemu-devel] different IDTs of the same VCPU Alexander Binun
2014-03-13 15:15                         ` Paolo Bonzini [this message]
2014-03-17 11:54                           ` Alexander Binun
2014-03-17 12:20                             ` Paolo Bonzini

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=5321CBAC.20104@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=binun@cs.bgu.ac.il \
    --cc=boaz.menuhin@gmail.com \
    --cc=kahilm@post.bgu.ac.il \
    --cc=markbl@post.bgu.ac.il \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=yagel@cs.bgu.ac.il \
    /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).