summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kaster <andrewdkaster@gmail.com>2020-12-31 17:51:21 -0700
committerAndreas Kling <kling@serenityos.org>2021-01-01 02:12:28 +0100
commita3a9016701e487a5ca92d83b8cff179a190cdeb2 (patch)
tree9fe412d881062d349d5119235874228a144b84e9
parent4ea4cd5ee3adeca347364555b61b75788ea38570 (diff)
downloadserenity-a3a9016701e487a5ca92d83b8cff179a190cdeb2.zip
DynamicLoader: Tell the linker to not add a PT_INTERP header
Use the GNU LD option --no-dynamic-linker. This allows uncommenting some code in the Kernel that gets upset if your ELF interpreter has its own interpreter.
-rw-r--r--Kernel/Syscalls/execve.cpp10
-rw-r--r--Userland/DynamicLoader/CMakeLists.txt1
2 files changed, 5 insertions, 6 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 35b8d81b9e..c386f1b49b 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -634,12 +634,10 @@ KResultOr<NonnullRefPtr<FileDescription>> Process::find_elf_interpreter_for_exec
return KResult(-ENOEXEC);
}
- // FIXME: Uncomment this
- // How do we get gcc to not insert an interpreter section to /usr/lib/Loader.so itself?
- // if (!interpreter_interpreter_path.is_empty()) {
- // dbgln("exec({}): Interpreter ({}) has its own interpreter ({})! No thank you!", path, interpreter_description->absolute_path(), interpreter_interpreter_path);
- // return KResult(-ELOOP);
- // }
+ if (!interpreter_interpreter_path.is_empty()) {
+ dbgln("exec({}): Interpreter ({}) has its own interpreter ({})! No thank you!", path, interpreter_description->absolute_path(), interpreter_interpreter_path);
+ return KResult(-ELOOP);
+ }
return interpreter_description;
}
diff --git a/Userland/DynamicLoader/CMakeLists.txt b/Userland/DynamicLoader/CMakeLists.txt
index 2a89e994c6..4b022f4f78 100644
--- a/Userland/DynamicLoader/CMakeLists.txt
+++ b/Userland/DynamicLoader/CMakeLists.txt
@@ -19,4 +19,5 @@ set(SOURCES ${LOADER_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${LIBC_SOURCES1} ${LI
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -pie -fpic -DNO_TLS")
add_executable(Loader.so ${SOURCES})
+target_link_options(Loader.so PRIVATE LINKER:--no-dynamic-linker)
install(TARGETS Loader.so RUNTIME DESTINATION usr/lib/)