Received: from eggs.gnu.org ([2001:4830:134:3::10]:40800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLVS9-0005rl-5z for qemu-devel@nongnu.org; Thu, 06 Mar 2014 05:23:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLVS0-0000PJ-Jo for qemu-devel@nongnu.org; Thu, 06 Mar 2014 05:23:01 -0500 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:42209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLVS0-0000Oy-D0 for qemu-devel@nongnu.org; Thu, 06 Mar 2014 05:22:52 -0500 Received: by mail-ee0-f49.google.com with SMTP id c41so1006669eek.22 for ; Thu, 06 Mar 2014 02:22:51 -0800 (PST) Date: Thu, 6 Mar 2014 11:22:45 +0100 From: Stefan Hajnoczi Message-ID: <20140306102245.GE23172@stefanha-thinkpad.redhat.com> References: <20131219090519.GA1976@stefanha-thinkpad.redhat.com> <201403051635.s25GZIiH002403@indigo.cs.bgu.ac.il> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201403051635.s25GZIiH002403@indigo.cs.bgu.ac.il> Subject: Re: [Qemu-devel] kill /destroy a VM - help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Binun Cc: kahilm@post.bgu.ac.il, boaz.menuhin@gmail.com, markbl@post.bgu.ac.il, qemu-devel@nongnu.org On Wed, Mar 05, 2014 at 06:35:18PM +0200, Alexander Binun wrote: > Now we encountered yet one problem: Our security module (which is a LKM) performs security check and, when suspecting malicious activity at a VCPU, must suspend or even kill this VM. The problem is: how to suspend/kill a VCPU ? > > We have taken the following approach: > 1. Accessing the VM list (struct list_head vms_list ) through the kallsyms interface > 2. Iterating through VMs, reaching every VCPU (as a structure struct kvm_vcpu *vcpu) > 3. Running security check on every such structure. That is we were seeking for a function like cpu_reset(struct kvm_vcpu*vcpu) > > The following "reset funtions" were so far tried (taken from kvm_host.h) > 1. kvm_vcpu_uninit and kvm_x86_ops->vcpu_free. These cause the whole system (both host and guest OSs) hang. > 2. kvm_vcpu_reset and kvm_arch_vcpu_free lead to the linker error "Warning! Function undefined". > > Which "reset function" could you recommend ? The simplest thing to kill a VM is to send SIGTERM to the QEMU process (the process that contains the vcpu thread). Stefan