git: ca18304ea491 - main - arm, arm64: tweak hard-coded load addresses for PIE binaries
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Oct 2022 16:00:52 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=ca18304ea491263389b8b1239e9b5b21d80da7f5
commit ca18304ea491263389b8b1239e9b5b21d80da7f5
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-10-22 10:58:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-10-25 16:00:44 +0000
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