From: Ingo Molnar Subject: Re: [patch] kvm: make cr3 loading more robust Date: Wed, 3 Jan 2007 12:52:30 +0100 Message-ID: <20070103115230.GB937@elte.hu> References: <20070103021057.GA11316@elte.hu> <459B695C.5090004@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel Return-path: To: Avi Kivity Content-Disposition: inline In-Reply-To: <459B695C.5090004-atKUWr5tajBWk0Htik3J/w@public.gmane.org> 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 * Avi Kivity wrote: > >rmap_write_protect() has a BUG_ON() if a physical address is not > >found the the memslot. But this is a possible scenario if a buggy > >guest OS loads an invalid or corrupted cr3 value. So exit more > >gracefully. > > I think a better solution is to detect the invalid cr3 in new_cr3(). > That way the entire chain of error returns is avoided. i'm wondering what the right semantics would be though. Kill the VM context? on a real CPU an invalid cr3 does nothing explicitly (besides being a sure way to get a triple fault) - physical memory is always accessible, non-present physical memory at most generates an #MCE, but is typically just returning 0xff, right? So perhaps keep a non-mapped page filled with 0xff and map non-existent RAM to that? But then this 'RAM' needs to be made non-writable. Looks a bit messy. Cleanest would be to kill the VM context (without injecting any fault into the guest), but that would then require an error return chain from set_cr3() ... Ingo ------------------------------------------------------------------------- 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