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

Konstantin Belousov kostikbel at gmail.com
Sat Nov 3 19:52:09 UTC 2018


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.    */


More information about the svn-src-head mailing list