From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64919 invoked by alias); 14 Mar 2017 10:20:00 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 64891 invoked by uid 89); 14 Mar 2017 10:19:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1541, 30am X-HELO: mail-pg0-f67.google.com Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Mar 2017 10:19:57 +0000 Received: by mail-pg0-f67.google.com with SMTP id b5so23591259pgg.1 for ; Tue, 14 Mar 2017 03:19:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QNWJDuOi9u3Sht5a6R+X8mf1RzIdUnwPJS3blnUFIKE=; b=eqFM41KH8Bew+ICydT9XFDNsCa9IgWOsZGUgjRp6Abhkgk3tpywJaQe4a5Y8XgOTWn wxhZvrgOhVEZGknRsRhXTt/Btwl6KVmAgTZHmrgKMUSQey8goj6YSVDwxw9uoRQ8ZCZb LV6lS4SPHkW7hk08PAuC5TYBguVFTTQUcXx/MpzjQt7YWtKE6CzXdOAjGLJgfAKzRK5z 23w1CJBrzbuLo+4btkzjEvJayfoL18ZJ4YRQhfG7O5uwoqJTddORZ7ji85zRFUCiVkbs M/Nw+tVB0nlgi5mJbOr1IPisbfmPlZoSojQO4wwKeO+VuFTkTJedJIIwQz4gAucU7G8X vrmw== X-Gm-Message-State: AMke39mWgLqPqMJgiX8vQvIptMAkdashp2n+Rb8Wz9q5qtz/HXU0jjwcfR6YVcmTwvOogQ== X-Received: by 10.98.68.199 with SMTP id m68mr42762359pfi.31.1489486796886; Tue, 14 Mar 2017 03:19:56 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id c1sm37593042pfk.112.2017.03.14.03.19.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 03:19:56 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 37AA1CC5B2; Tue, 14 Mar 2017 20:49:52 +1030 (ACDT) Date: Tue, 14 Mar 2017 10:20:00 -0000 From: Alan Modra To: Tristan Gingold Cc: "H.J. Lu" , binutils Subject: Re: [Patch] ld: check for address space overflow Message-ID: <20170314101952.GL4983@bubble.grove.modra.org> References: <0C5EB7A7-DFB1-404C-A976-E96FC881B89A@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00198.txt.bz2 On Tue, Mar 14, 2017 at 09:15:30AM +0100, Tristan Gingold wrote: > [...] > > > This works: > > > > diff --git a/ld/ldlang.c b/ld/ldlang.c > > index a0638ea..8c1d829 100644 > > --- a/ld/ldlang.c > > +++ b/ld/ldlang.c > > @@ -4783,13 +4783,13 @@ lang_check_section_addresses (void) > > for (s = link_info.output_bfd->sections; s != NULL; s = s->next) > > { > > s_end = (s->vma + s->size) & addr_mask; > > - if (s_end != 0 && s_end < s->vma) > > + if (s_end != 0 && s_end < (s->vma & addr_mask)) > > einfo (_("%X%P: section %s VMA wraps around address space\n"), > > s->name); > > else > > { > > s_end = (s->lma + s->size) & addr_mask; > > - if (s_end != 0 && s_end < s->lma) > > + if (s_end != 0 && s_end < (s->lma & addr_mask)) > > einfo (_("%X%P: section %s LMA wraps around address space\n"), > > s->name); > > } > > Yes, that makes sense. > Do you plan to commit it ? The new testcases need some tweaking too. Even after applying the above I'm left with: arm-aout +FAIL: section size overflow arm-coff +FAIL: section size overflow arm-epoc-pe +FAIL: section size overflow arm-pe +FAIL: section size overflow arm-symbianelf +FAIL: section size overflow arm-wince-pe +FAIL: section size overflow i386-linuxaout +FAIL: section size overflow i386-linuxaout +FAIL: section size overflow i386-lynxos +FAIL: section size overflow i386-netware +FAIL: section size overflow i586-aout +FAIL: section size overflow i686-pe +FAIL: section size overflow -- Alan Modra Australia Development Lab, IBM