diff options
author | Tim Schumacher <timschumi@gmx.de> | 2021-11-13 17:53:43 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-14 22:25:15 +0100 |
commit | 292398b5857d0104f7c33fdb5d79f45fe8b395dd (patch) | |
tree | c16415219a6d23fc1f17c505eff284b3e2b9bb62 /Toolchain/Patches | |
parent | 4d79ab6866054f23ecb2a0fac16ef180884b7bd6 (diff) | |
download | serenity-292398b5857d0104f7c33fdb5d79f45fe8b395dd.zip |
Toolchain: Load x64 executables at a higher address
Serenity defines a protected range of memory that must not be mmapped,
and is apparently reserved for kernel tasks. In this case, the protected
range is anything below 0x800000.
However, in its default setting, binutils chooses the memory address
0x400000 as the mapping address for executables that do not have PIE
enabled, resulting in mmap being unable to map the file unless the load
address has been overwritten at link time or if it's a PIE.
To mitigate this, move the default base address somewhere outside of
that range (and preferably not anywhere close near the beginning of the
useable virtual memory space, to avoid running into it during sequential
allocations).
Diffstat (limited to 'Toolchain/Patches')
-rw-r--r-- | Toolchain/Patches/binutils.patch | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Toolchain/Patches/binutils.patch b/Toolchain/Patches/binutils.patch index eadc7ee056..b930fb3b8d 100644 --- a/Toolchain/Patches/binutils.patch +++ b/Toolchain/Patches/binutils.patch @@ -179,3 +179,15 @@ index df09b7b8..21566f5f 100644 uint64_t bound_lifetime_depth; }; +diff -ur a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh +--- a/ld/emulparams/elf_x86_64.sh 2021-07-08 13:37:20.000000000 +0200 ++++ b/ld/emulparams/elf_x86_64.sh 2021-11-13 17:52:50.396490742 +0100 +@@ -12,7 +12,7 @@ + ELFSIZE=64 + OUTPUT_FORMAT="elf64-x86-64" + NO_REL_RELOCS=yes +-TEXT_START_ADDR=0x400000 ++TEXT_START_ADDR=0x08200000 + MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" + COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" + ARCH="i386:x86-64" |