svn commit: r339876 - head/libexec/rtld-elf

Mark Millard marklmi26-fbsd at yahoo.com
Sun Nov 4 11:12:03 UTC 2018


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>,0xffffffff,0x10000,0,0)
>> 80903 ld-elf.so.1 RET   mmap -1 errno 12 Cannot allocate memory
> 
> This is the allocation of VA for the whole binary.  I guess that the normal
> non-PIE binary virtual base on arm is 0x10000.
> 
> 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.
> 
> You can try to change ET_DYN_LOAD_ADDR on arm:
> 
> 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
> 
> -#define	ET_DYN_LOAD_ADDR	0x12000
> +#define	ET_DYN_LOAD_ADDR	0x500000
> 
> /* 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).

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



More information about the svn-src-head mailing list