From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] KVM: SVM: Emulate next_rip svm feature Date: Wed, 28 Jul 2010 14:34:11 +0300 Message-ID: <4C5015B3.8010003@redhat.com> References: <1280247261-19115-1-git-send-email-joerg.roedel@amd.com> <1280247261-19115-3-git-send-email-joerg.roedel@amd.com> <4C4F2643.8080507@redhat.com> <20100728093708.GD26098@amd.com> <4C500636.1070708@redhat.com> <20100728112540.GE26098@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: "Roedel, Joerg" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:10019 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753896Ab0G1LeS (ORCPT ); Wed, 28 Jul 2010 07:34:18 -0400 In-Reply-To: <20100728112540.GE26098@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/28/2010 02:25 PM, Roedel, Joerg wrote: > On Wed, Jul 28, 2010 at 06:28:06AM -0400, Avi Kivity wrote: >> We have a slightly different problem, if the nested guest manages to get >> an instruction to be emulated by the host (if the guest assigned it the >> cirrus framebuffer, for example, so from L1's point of view it is RAM, >> but from L0's point of view it is emulated), then we miss the >> intercept. L2 could take over L1 this way. > I wonder how this could happen. Shouldn't the shadow paging code take > care of this? > L1 thinks the memory is RAM, so it maps it directly and forgets about it. L0 knows it isn't, so it leaves it unmapped and emulates any instruction which accesses it. The emulator needs to check whether the instruction is intercepted or not. Note, I think if the instruction operand is in mmio, we're safe, since the intercept has higher priority than memory access. But if the instruction itself is on mmio, or if we entered the emulator through smp trickery, then the emulator will execute the instruction in nested guest context. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.