From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Joerg Roedel" Subject: Re: [PATCH] SVM: forbid guest to execute monitor/mwait Date: Thu, 22 Mar 2007 12:07:33 +0100 Message-ID: <20070322110733.GE20139@amd.com> References: <20070321184700.GA20139@amd.com> <46023264.4010105@qumranet.com> <20070322095605.GB20139@amd.com> <46025528.5010707@qumranet.com> <20070322101729.GC20139@amd.com> <46025D94.8050606@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: "Avi Kivity" Return-path: In-Reply-To: <46025D94.8050606-atKUWr5tajBWk0Htik3J/w@public.gmane.org> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org On Thu, Mar 22, 2007 at 12:42:28PM +0200, Avi Kivity wrote: > Joerg Roedel wrote: > >There is no danger for the host kernel but for the guest. If the > >userspace sets the monitor bit the guest will receive an #UD when trying > >to use it. And we don't want the guest to use it because it is not > >virtualized yet. > > > > So, isn't a simpler fix not to set the monitor bit in cpuid? > > The patch is correct, but I don't see why it's needed as any guest will check the cpuid bit > before using monitor. Right. But it is possible for userspace to enable monitor bit for the guest. Without virtualization of these 2 instructions the guest would idle in the guest state after calling mwait and prevent other processes and guests from running in that time. I don't think this is acceptable. And if we disable this bit in cpuid we should also prevent the guest from executing it to emulate the behavior of a real cpu in host mode. So I agree we should mask the cpuid monitor bit. The savest way to do so is in the kvm-amd module imho. And, also imho, we should the guest really forbid to execute it. Joerg -- Joerg Roedel Operating System Research Center AMD Saxony LLC & Co. KG ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV