From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nadav Har'El" Subject: Re: [PATCH 7/24] Understanding guest pointers to vmcs12 structures Date: Mon, 2 Aug 2010 11:57:50 +0300 Message-ID: <20100802085750.GA27579@fermat.math.technion.ac.il> References: <1276431753-nyh@il.ibm.com> <201006131226.o5DCQ95O012945@rice.haifa.ibm.com> <20100615121419.GU21797@redhat.com> <20100801151659.GA11054@fermat.math.technion.ac.il> <20100801152505.GK24773@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mailgw13.technion.ac.il ([132.68.225.13]:7882 "EHLO mailgw13.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575Ab0HBI5x (ORCPT ); Mon, 2 Aug 2010 04:57:53 -0400 Content-Disposition: inline In-Reply-To: <20100801152505.GK24773@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Aug 01, 2010, Gleb Natapov wrote about "Re: [PATCH 7/24] Understanding guest pointers to vmcs12 structures": > 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. Thanks. Unfortunately, I also use this function to decode non-page-aligned addresses (such as an address given to VMWRITE to take a value from), so I cannot use this nice trick. > 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. I guess this means that I can easily find a gva_t which is always invalid - e.g., 1<<63 isn't a legal 32-bit address (of course), and also isn't a legal canonical-form 64 (or rather 48)-bit address - so I could use that as a flag. But I decided that to make things clearer, I'll change the function to return a success flag, and return the gva_t itself into a given pointer: static int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, u32 vmx_instruction_info, gva_t *ret) -- Nadav Har'El | Monday, Aug 2 2010, 22 Av 5770 nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Can Microsoft make a product that doesn't http://nadav.harel.org.il |suck? Yes, a vacuum cleaner!