Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Nov 2018 21:51:57 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Mark Millard <marklmi26-fbsd@yahoo.com>
Cc:        svn-src-head@freebsd.org, Alexander Richardson <arichardson@freebsd.org>
Subject:   Re: svn commit: r339876 - head/libexec/rtld-elf
Message-ID:  <20181103195157.GT5335@kib.kiev.ua>
In-Reply-To: <1AD60949-F621-4F24-8985-B02102824EB1@yahoo.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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.    */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181103195157.GT5335>