From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 7/24] Understanding guest pointers to vmcs12 structures Date: Sun, 1 Aug 2010 18:25:05 +0300 Message-ID: <20100801152505.GK24773@redhat.com> References: <1276431753-nyh@il.ibm.com> <201006131226.o5DCQ95O012945@rice.haifa.ibm.com> <20100615121419.GU21797@redhat.com> <20100801151659.GA11054@fermat.math.technion.ac.il> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754208Ab0HAPZL (ORCPT ); Sun, 1 Aug 2010 11:25:11 -0400 Content-Disposition: inline In-Reply-To: <20100801151659.GA11054@fermat.math.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Aug 01, 2010 at 06:16:59PM +0300, Nadav Har'El wrote: > On Tue, Jun 15, 2010, Gleb Natapov wrote about "Re: [PATCH 7/24] Understanding guest pointers to vmcs12 structures": > > > +/* > > > + * Decode the memory-address operand of a vmx instruction, according to the > > > + * Intel spec. > > > + */ > >... > > > +static gva_t get_vmx_mem_address(struct kvm_vcpu *vcpu, > > > + unsigned long exit_qualification, > > > + u32 vmx_instruction_info) > > > +{ > >... > > > + if (is_reg) { > > > + kvm_queue_exception(vcpu, UD_VECTOR); > > > + return 0; > > Isn't zero a legitimate address for vmx operation? > > Thanks. Please excuse my naivity, but is address 0 actually considered a > usable guest virtual address? If it is, do we have any possible value which is > considered invalid? Perhaps -1ull? I see that -1ull is used in a few places > in vmx.c, for example. > Guest can use any valid virtual address. There is UNMAPPED_GVA (~(gpa_t)0) which at least cannot be valid if address that your function returns have to be page aligned. And not all virtual addresses are valid BTW. For 32 bit guest virt address cannot be bigger then 32 bit and for 64 bit guest virtual address should be in canonical form. > If all gva_t turn out to actually be valid addresses, I'll need to move to a > more complex (and uglier) success flag approach :( > > -- > Nadav Har'El | Sunday, Aug 1 2010, 22 Av 5770 > nyh@math.technion.ac.il |----------------------------------------- > Phone +972-523-790466, ICQ 13349191 |The only "intuitive" interface is the > http://nadav.harel.org.il |nipple. After that, it's all learned. -- Gleb.