From owner-svn-src-head@freebsd.org Tue Oct 30 18:04:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5847E10EFD1B; Tue, 30 Oct 2018 18:04:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3789720DB; Tue, 30 Oct 2018 18:04:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w9UI3qUH046034 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 30 Oct 2018 20:03:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w9UI3qUH046034 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w9UI3qNm046033; Tue, 30 Oct 2018 20:03:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 30 Oct 2018 20:03:52 +0200 From: Konstantin Belousov To: Alexander Richardson Cc: Michael.Tuexen@macmic.franken.de, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r339876 - head/libexec/rtld-elf Message-ID: <20181030180352.GO5335@kib.kiev.ua> References: <201810292108.w9TL83bO041913@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 18:04:04 -0000 On Tue, Oct 30, 2018 at 03:32:40PM +0000, Alexander Richardson wrote: > On Tue, 30 Oct 2018 at 10:17, Michael Tuexen > wrote: > > > > > On 29. Oct 2018, at 22:08, Alex Richardson wrote: > > > > > > Author: arichardson > > > Date: Mon Oct 29 21:08:02 2018 > > > New Revision: 339876 > > > URL: https://svnweb.freebsd.org/changeset/base/339876 > > > > > > Log: > > > rtld: set obj->textsize correctly > > > > > > With lld-generated binaries the first PT_LOAD will usually be a read-only > > > segment unless you pass --no-rosegment. For those binaries the textsize is > > > determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to > > > be parsed correctly use the end of the last PT_LOAD that is marked as > > > executable instead. > > > > > > I noticed that the value was wrong while adding some debug prints for some rtld > > > changes for CHERI binaries. `obj->textsize` only seems to be used by PPC so the > > > effect is untested. However, the value before was definitely wrong and the new > > > result matches the phdrs. > > I build kernel and world with a revision later than this on a PPC. Buildword > > ends up with a world where almost all binaries are segfaulting.... Especially gdb > > (but svn, ls or so all segfault). > > > > Best regards > > Michael > > This is rather surprising since if anything the range of the icache > flush should increase rather than decrease after this change. > > I can only see this causing a behaviour change if we actually need to > flush more than just the executable segments. > Is it possible that some binary/library contains a non-executable > segment as the first PT_LOAD? > Or is there some linker script that adds custom PHDRS? > Could it be that there is a hole between start of the object mapping and the last PT_LOADable segment eligible for execution ?