From: Ian Jackson Subject: Re: [PATCH 10/16] libelf: check all pointer accesses Date: Thu, 6 Jun 2013 19:11:57 +0100 Message-ID: <20912.53485.171553.70974@mariner.uk.xensource.com> References: <1370368803-9436-1-git-send-email-ian.jackson@eu.citrix.com> <1370368803-9436-11-git-send-email-ian.jackson@eu.citrix.com> <20912.41460.731600.334824@mariner.uk.xensource.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: George Dunlap Cc: Andrew Cooper , "xen-devel@lists.xensource.com" , mattjd@gmail.com, security@xen.org List-Id: xen-devel@lists.xenproject.org George Dunlap writes ("Re: [Xen-devel] [PATCH 10/16] libelf: check all pointer accesses"): > On Thu, Jun 6, 2013 at 3:51 PM, Ian Jackson wrote: > > Making the change you propose would raise questions about whether (eg) > > some other code somewhere might think dest_base==0 means something > > special. (I don't think it does, but it's an argument against > > changing things.) > > Yes, of course there is a problem; what I was suggesting was, > supposing there were such a problem, which would be most likely to > show it up in a helpful way -- setting dest_base to 0, or leaving it > to what is (at the moment) a valid address? Setting it to 0 would be semantically wrong for that other code. Leaving it as a non-0 value would be right. All the places where it's used have been changed to check the dest_size too. > We could also, I suppose, do "dest_base+=dest_size" before setting > dest_size to 0. Then dest_base in theory shouldn't be a valid address > either. That would be Undefined Behaviour. If we did that the compiler might be "entitled" to "prove" false things about our code, and compile it. Ian.