From: Ian Jackson Subject: Re: [PATCH v3 8/8] libxl, hvmloader: Don't relocate memory for MMIO hole Date: Fri, 21 Jun 2013 12:31:48 +0100 Message-ID: <20932.14756.243986.665128@mariner.uk.xensource.com> References: <1371746007-19073-1-git-send-email-george.dunlap@eu.citrix.com> <1371746007-19073-9-git-send-email-george.dunlap@eu.citrix.com> <51C40F7B.8010803@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Keir Fraser , Ian Campbell , Hanweidong , George Dunlap , xen-devel@lists.xen.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Stefano Stabellini writes ("Re: [PATCH v3 8/8] libxl,hvmloader: Don't relocate memory for MMIO hole"): > On Fri, 21 Jun 2013, George Dunlap wrote: > > The only valid values here are "0" and "1"; everything else is undefined. > > This code doesn't do what you say: "0" means false and everything else > means true. The undefined values are treated as true. Is that what we > want? I think it's acceptable. Many other kernel-level and embedded consumers of xenstore do similar things. This is not a security-relevant boundary and anyway the "wrong" behaviours are all tolerable; furthermore hvmloader doesn't have a particularly good way to report errors. > In order to do what you say you would need: > > bool allow_memory_relocate = 1; > int i; > i = strtoll(s, NULL, 0); No, you need to also - pass a non-NULL 2nd argument and check that on return it points to null (in case the string had nondigits in it) - check that the input string is not empty (eg by checking that the end pointer returned via the 2nd argument is not equal to the start of the string) - set errno to 0 beforehand and check it afterwards (in case of ERANGE) (and anyway I bet hvmloader's strtoll gets this wrong so it's probably pointless) This is far too much faff and is ultimately pointless. I think we should say "0" and "1" are currently defined and other integer values are reserved and should be treated the same way as "1". Ian.