Date: Thu, 21 May 2020 13:13:00 -0400 From: Mark Johnston <markj@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, Antoine Brodin <antoine@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head@freebsd.org Subject: Re: svn commit: r361303 - in head: lib/libc/gen libexec/rtld-elf sys/sys Message-ID: <20200521171300.GG85681@raichu> In-Reply-To: <20200521170958.GG64045@kib.kiev.ua> References: <202005202208.04KM8QPA020707@repo.freebsd.org> <CAALwa8mXfJZyRQ-Gx684mgoeTDZs14tEP26rJNqvh_rEiY18=Q@mail.gmail.com> <20200521134152.GE64045@kib.kiev.ua> <20200521151248.GA85681@raichu> <c7fce441-692e-e4d6-64cb-ae86ef13c6cb@FreeBSD.org> <20200521165646.GF64045@kib.kiev.ua> <20200521170124.GE85681@raichu> <20200521170958.GG64045@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 21, 2020 at 08:09:58PM +0300, Konstantin Belousov wrote: > On Thu, May 21, 2020 at 01:01:24PM -0400, Mark Johnston wrote: > > On Thu, May 21, 2020 at 07:56:46PM +0300, Konstantin Belousov wrote: > > > On Thu, May 21, 2020 at 09:03:44AM -0700, John Baldwin wrote: > > > > On 5/21/20 8:12 AM, Mark Johnston wrote: > > > > > On Thu, May 21, 2020 at 04:41:52PM +0300, Konstantin Belousov wrote: > > > > >> On Thu, May 21, 2020 at 03:02:07PM +0200, Antoine Brodin wrote: > > > > >>> On Thu, May 21, 2020 at 12:08 AM Konstantin Belousov <kib@freebsd.org> wrote: > > > > >>>> > > > > >>>> Author: kib > > > > >>>> Date: Wed May 20 22:08:26 2020 > > > > >>>> New Revision: 361303 > > > > >>>> URL: https://svnweb.freebsd.org/changeset/base/361303 > > > > >>>> > > > > >>>> Log: > > > > >>>> Change the samantic of struct link_map l_addr member. > > > > >>>> > > > > >>>> It previously returned the object map base address, while all other > > > > >>>> ELF operating systems return load offset, i.e. the difference between > > > > >>>> map base and the link base. > > > > >>>> > > > > >>>> Explain the meaning of the field in the man page. > > > > >>>> > > > > >>>> Stop filling the mips-only l_offs member, which is apparently unused. > > > > >>>> > > > > >>>> PR: 246561 > > > > >>>> Requested by: Damjan Jovanovic <damjan.jov@gmail.com> > > > > >>>> Reviewed by: emaste, jhb, cem (previous version) > > > > >>>> Sponsored by: The FreeBSD Foundation > > > > >>>> MFC after: 1 week > > > > >>>> Differential revision: https://reviews.freebsd.org/D24918 > > > > >>>> > > > > >>>> Modified: > > > > >>>> head/lib/libc/gen/dlinfo.3 > > > > >>>> head/libexec/rtld-elf/rtld.c > > > > >>>> head/sys/sys/link_elf.h > > > > >>> > > > > >>> Hi, > > > > >>> > > > > >>> After this commit, some ports fail to build with signal 11. > > > > >>> For instance lang/perl5.30 fails to build with default options (DTRACE on) > > > > >>> Disabling the DTRACE option makes it able to build again. > > > > >>> > > > > >> I see, thank you for reporting. > > > > >> > > > > >> So drti.c:dtrace_dof_init() does read l_addr, and the dtrace code assumes > > > > >> that l_addr is the base, not relocbase. > > > > >> > > > > >> Mark, was dofhp_addr initialization changed comparing to Solaris ? > > > > > > > > > > It appears it has been the same since DTrace was imported. illumos > > > > > still has similar code. > > > > > > > > > > Note that drti.o is linked into any executable and shlib that defines > > > > > static probes, so the ABI change affects more than just dtrace(1). > > > > > Would it be possible to define a new value for RTLD_DI_LINKMAP, and > > > > > preserve the old behaviour for the old value? > > > > > > > > I think a bigger question is if Solaris/illumos treat l_addr as mapbase > > > > (absolute address) or relocbase (relative address). In the discussion > > > > in the phabricator I had assumed that all other OS's treated l_addr as > > > > the relative offset (relocbase). Does the code for illumos assume an > > > > absolute address or does it assume a relative address in l_addr? > > > > > > It is rather clear, since the dtrace code was pristine, that Solaris > > > provides the mapbase. I do not have Solaris/Illumos box anymore > > > (for quite some time), so I cannot check directly. > > > > > > My current PoV is that l_addr semantic must be restored, and relocbase > > > provided by newly added member. > > > > > > BTW, it is strange that perl triggers it, is it linked as PIE on HEAD ? > > > > Isn't the problem when perl is *not* linked as PIE? In this case > > relocbase is 0, so the ELF header access becomes a NULL pointer > > dereference. > drti checks for ET_DYN, only then it uses l_addr at all. The problem is before that, where it treats l_addr as a pointer to the ELF header so it can check the type. > PIE binaries are dso with non-zero base, non-PIE binaries are ET_EXEC, > which should make dtri.c ignore the l_addr value.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200521171300.GG85681>