From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLWTo-0008Cn-Ax for qemu-devel@nongnu.org; Thu, 06 Mar 2014 06:28:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLWTf-0004MW-UJ for qemu-devel@nongnu.org; Thu, 06 Mar 2014 06:28:48 -0500 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:40831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLWTf-0004Kf-Mk for qemu-devel@nongnu.org; Thu, 06 Mar 2014 06:28:39 -0500 Received: by mail-ea0-f169.google.com with SMTP id h14so1655355eaj.28 for ; Thu, 06 Mar 2014 03:28:38 -0800 (PST) Sender: Paolo Bonzini Message-ID: <53185BE2.4080101@redhat.com> Date: Thu, 06 Mar 2014 12:28:34 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20140306102245.GE23172@stefanha-thinkpad.redhat.com> <201403061031.s26AVWJL012337@indigo.cs.bgu.ac.il> In-Reply-To: <201403061031.s26AVWJL012337@indigo.cs.bgu.ac.il> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] kill /destroy a VM - help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Binun , Stefan Hajnoczi Cc: kahilm@post.bgu.ac.il, boaz.menuhin@gmail.com, markbl@post.bgu.ac.il, qemu-devel@nongnu.org Il 06/03/2014 11:31, Alexander Binun ha scritto: > Then - more questions : > 1. How can I access the Qemu process (relevant to a given VM) from within in the kernel context (being in a kernel module) ? The struct pid for the VCPU is in the "pid" field of struct kvm_vcpu. From there if needed you can get the task (with pid_task) and the task's thread group leader (the task's group_leader), and send a signal to it. > 2. Should I uninitialize some internal structures for the VM being killed ? No, it will happen automatically. When QEMU is terminated, the VM's file descriptor is closed and this frees all internal structures. > 3. My module detects malicious activities at a VCPU. How can one get the VM owning this VCPU ? Field "kvm" in struct kvm_vcpu points to the struct kvm for the VM. Paolo