From ca18304ea491263389b8b1239e9b5b21d80da7f5 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 22 Oct 2022 13:58:43 +0300 Subject: [PATCH] arm, arm64: tweak hard-coded load addresses for PIE binaries They are used when ASLR is not applied. The need for adjusting is due to rtld direct exec mode puts ld-elf.so.1 at the PIE load address, and this address must not conflict with the default linker' load address for non-PIE binaries. Otherwise rtld in direct mode cannot activate image. Example of implicit failure is ldd(1) refusing to run. Reported by: kp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37085 --- sys/arm/include/elf.h | 2 +- sys/arm64/include/elf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm/include/elf.h b/sys/arm/include/elf.h index affd4b349163..35d0fa55ca1a 100644 --- a/sys/arm/include/elf.h +++ b/sys/arm/include/elf.h @@ -78,7 +78,7 @@ __ElfType(Auxinfo); #define EF_ARM_EABI_VERSION_UNKNOWN 0 #define EF_ARM_EABI_FREEBSD_MIN 4 -#define ET_DYN_LOAD_ADDR 0x500000 +#define ET_DYN_LOAD_ADDR 0x01001000 /* Flags passed in AT_HWCAP. */ #define HWCAP_SWP 0x00000001 /* Unsupported, never set. */ diff --git a/sys/arm64/include/elf.h b/sys/arm64/include/elf.h index 3f7c3964d428..22e968c632bf 100644 --- a/sys/arm64/include/elf.h +++ b/sys/arm64/include/elf.h @@ -86,7 +86,7 @@ __ElfType(Auxinfo); #endif #if __ELF_WORD_SIZE == 32 -#define ET_DYN_LOAD_ADDR 0x12000 +#define ET_DYN_LOAD_ADDR 0x01001000 #else #define ET_DYN_LOAD_ADDR 0x100000 #endif