From: Keir Fraser Subject: Re: out of bounds handling for get_mfn_from_gpfn() Date: Wed, 26 Apr 2006 13:44:36 +0100 Message-ID: References: <444F7D2C.76E4.0078.0@novell.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <444F7D2C.76E4.0078.0@novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 26 Apr 2006, at 13:01, Jan Beulich wrote: > - add a bounds check to get_mfn_from_gpfn() (in which case I'd be > uncertain what the correct boundary is, since on 64 > bits (RO_MPT_VIRT_END - RO_MPT_VIRT_START) != (RDWR_MPT_VIRT_END - > RDWR_MPT_VIRT_START), and only one of the two ranges > can be the correct one) A range check is needed as the function can be passed unvalidated values from a guest. The tables you mention above are not involved in get_mfn_from_gpfn() -- they translate the other way. The input gpfn either needs testing against, or masking with, (PADDR_MASK >> PAGE_SHIFT). We should always ensure that the m2p and p2m tables are big enough to be indexed by that value. I don't think that the mfn-to-gpfn direction needs a check, but an assertion might be worthwhile. -- Keir