From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29436 invoked from network); 26 Sep 2020 09:10:07 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 26 Sep 2020 09:10:07 -0000 Received: (qmail 7576 invoked by uid 550); 26 Sep 2020 09:10:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7558 invoked from network); 26 Sep 2020 09:10:04 -0000 Date: Sat, 26 Sep 2020 11:09:52 +0200 From: Szabolcs Nagy To: Fangrui Song Cc: musl@lists.openwall.com, Rich Felker Message-ID: <20200926090952.GK2947641@port70.net> Mail-Followup-To: Fangrui Song , musl@lists.openwall.com, Rich Felker References: <20200925093733.GJ2947641@port70.net> <7318ee2c-17f5-99a9-12e4-622fe94cbfe2@gmail.com> <20200925224607.GP3265@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [musl] SIGSEGV with TEXTREL * Fangrui Song [2020-09-25 21:14:18 -0700]: > On Fri, Sep 25, 2020 at 7:53 PM Dominic Chen wrote: > > > > On 9/25/2020 6:46 PM, Rich Felker wrote: > > > > > > The right way to make this more friendly, I think, would be tracking > > > the writable mapping range for each DSO (technically this is > > > incomplete since it could be multiple ranges, but in that case we'd > > > just take the convex hull of them and accept false negatives because > > > anything else is almost surely too big a performance hit), and > > > erroring out before processing a relocation at an address that's not > > > writable for its DSO. This would also go part of the way towards > > > making it possible for ldd to process untrusted files. > > > > I agree that that seems to be a better solution, and it was also > > discussed in the previous mailing list thread. But my point is just that > > given how this issue has been reoccurring, I think it'd be useful to do > > something now (e.g. emit a non-fail warning if TEXTRELs are present), > > rather than deferring any changes. > > > > Thanks, > > > > Dominic > > binutils 2.35 can be configured with --enable-textrel-check=yes, and > Linux/x86 defaults to 'yes'. ld emits a warning upon a text > relocation: > > warning: creating DT_TEXTREL in a PIE > > (LLD always disallows text relocations by default (-z text). You need > -z notext to enable DF_TEXTREL and text relocations.) nice and gcc passes -z text for static pie code so that case should not end up with text rels.