Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Nov 2018 03:11:55 -0800
From:      Mark Millard <marklmi26-fbsd@yahoo.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, Alexander Richardson <arichardson@freebsd.org>
Subject:   Re: svn commit: r339876 - head/libexec/rtld-elf
Message-ID:  <7FB28CEE-9997-4F8E-B401-F6D0A1C7884C@yahoo.com>
In-Reply-To: <20181103195157.GT5335@kib.kiev.ua>
References:  <E44F5772-1F8A-40B8-9C4E-B8362B768F37@yahoo.com> <003A49D7-6E8B-4775-A70B-E0EB44505D4B@yahoo.com> <20181102113827.GM5335@kib.kiev.ua> <7B29A4C8-228D-41CB-B594-98DFA456E9C8@yahoo.com> <20181102155234.GN5335@kib.kiev.ua> <E93B3880-281E-482C-9DA7-851398543B97@yahoo.com> <20181102185014.GP5335@kib.kiev.ua> <34554290-D26E-4FED-A598-4FB3E313EA92@yahoo.com> <20181103154955.GR5335@kib.kiev.ua> <1AD60949-F621-4F24-8985-B02102824EB1@yahoo.com> <20181103195157.GT5335@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2018-Nov-3, at 12:51 PM, Konstantin Belousov <kostikbel at gmail.com> =
wrote:

> On Sat, Nov 03, 2018 at 12:04:53PM -0700, Mark Millard wrote:
>> 80903 ld-elf.so.1 CALL  =
mmap(0x10000,0xb000,0<PROT_NONE>,0x6010<MAP_FIXED|MAP_GUARD|MAP_EXCL>,0xff=
ffffff,0x10000,0,0)
>> 80903 ld-elf.so.1 RET   mmap -1 errno 12 Cannot allocate memory
>=20
> This is the allocation of VA for the whole binary.  I guess that the =
normal
> non-PIE binary virtual base on arm is 0x10000.
>=20
> I put the arm PIE base at 0x12000, which obviously causes the conflict
> between pre-loaded ld-elf.so.1 and later attempt to mmap the binary at
> the linked address.  In fact I am happy that we added MAP_EXCL and it
> catched the situation.
>=20
> You can try to change ET_DYN_LOAD_ADDR on arm:
>=20
> diff --git a/sys/arm/include/elf.h b/sys/arm/include/elf.h
> index 7424b45e78f..28fc14e3dae 100644
> --- a/sys/arm/include/elf.h
> +++ b/sys/arm/include/elf.h
> @@ -84,7 +84,7 @@ __ElfType(Auxinfo);
>  */
> #define	MAGIC_TRAMP_NUMBER	0x5c000003
>=20
> -#define	ET_DYN_LOAD_ADDR	0x12000
> +#define	ET_DYN_LOAD_ADDR	0x500000
>=20
> /* Flags passed in AT_HWCAP. */
> #define	HWCAP_SWP		0x00000001	/* Unsupported, =
never set.    */

I finally got to building-for, installing-on, booting-the, and
testing-the armv7 issue. The change worked:

# /libexec/ld-elf.so.1 /bin/ls -c1
.cshrc
.history
.k5login
.lesshst
.lldb
.login
.profile
.shrc
.subversion

(and so on).

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7FB28CEE-9997-4F8E-B401-F6D0A1C7884C>