From: Yacine HEBBAL Subject: Re: [Question] Switching VCPU CPL from the hypervisor ? Date: Thu, 17 Dec 2015 15:58:44 +0000 (UTC) Message-ID: References: <56704578.8080803@redhat.com> <5671A3F6.5060207@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from plane.gmane.org ([80.91.229.3]:33620 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934965AbbLQP6x (ORCPT ); Thu, 17 Dec 2015 10:58:53 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a9ax8-0003AX-I3 for kvm@vger.kernel.org; Thu, 17 Dec 2015 16:58:50 +0100 Received: from machine107.orange-labs.com ([161.106.0.5]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Dec 2015 16:58:50 +0100 Received: from y_hebbal by machine107.orange-labs.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Dec 2015 16:58:50 +0100 Sender: kvm-owner@vger.kernel.org List-ID: Paolo Bonzini redhat.com> writes: > On 15/12/2015 18:02, Hebbal Yacine wrote: > > What I want to do is: when a controlled process is in user mode, i > > change its cpl to 0, force it to execute a code that is injected in the > > VM, set back its cpl to 3 and let it run like if nothing happened > > Could you inject an SMI and place your code in the guest firmware's SMM > handler? What input is needed by this CPL=0 code? > > Paolo I think the the solution follows this logic, meaning we inject an interrupt, intercept execution of its handler (cpl is 0), save cpu context, execute the code we want, push a return address, and force the process to execute IRET instruction which will complete the cleaning, restore cpl to 3 and let the process resume its normal execution. I'll continue to dig this to see if there is any better approach, thanks for your help :) Yacine