diff options
author | Samuel Holland <samuel@sholland.org> | 2019-01-05 09:36:32 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2019-01-05 09:36:32 -0600 |
commit | d186323a2db1f8bf65b24236ce8d2ddff1b4385a (patch) | |
tree | 9a6b8cb275db8d142924eabc82ec9204a55ae5f9 | |
parent | de9e45d7f27dfe70634e9add7c3348aa3628a68e (diff) | |
download | gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.gz gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.bz2 gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.tar.xz gcompat-d186323a2db1f8bf65b24236ce8d2ddff1b4385a.zip |
Fix compatibility with Linux 4.17+
The gcompat loader compiled as a static binary doesn't work on Linux
since commit a4ff8e8620d3f4, failing with the error:
```
Uhuuh, elf segment at 0000000000400000 requested but the memory is mapped already
```
This is because the binary we are the ELF interpreter for is also loaded
at 0x400000. While it's actually okay to overlap the binary, since we're
going to call `execve` again, the kernel doesn't allow the overlap
anymore. Fix that by compiling the loader as static PIE, so it can be
loaded at a different address.
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | CHANGELOG.rst | 1 | ||||
-rw-r--r-- | Makefile | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 25b57e0..c494a38 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,7 @@ Build system ------------ * Allow building against libobstack. +* Fix compatibility with Linux 4.17 and newer. pthread ------- @@ -73,7 +73,7 @@ ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ} ${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE} ${LOADER_NAME}: ${LOADER_OBJ} - ${CC} ${CFLAGS} ${LDFLAGS} -static -o ${LOADER_NAME} ${LOADER_OBJ} + ${CC} ${CFLAGS} ${LDFLAGS} -static-pie -o ${LOADER_NAME} ${LOADER_OBJ} .c.o: ${CC} ${CPPFLAGS} ${CFLAGS} -c -D_BSD_SOURCE \ |