summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibELF/DynamicLinker.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-05 12:16:30 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-05 12:23:39 +0100
commite87eac92730f1cc55d7a44f8bb6331b4a8e33535 (patch)
treec8a17aba1bf677a5fc6059b018baa8f861fd1670 /Userland/Libraries/LibELF/DynamicLinker.cpp
parent4df3a34bc29a4fde57bd0d1ae408a3d094c10b62 (diff)
downloadserenity-e87eac92730f1cc55d7a44f8bb6331b4a8e33535.zip
Userland: Add LibSystem and funnel all syscalls through it
This achieves two things: - Programs can now intentionally perform arbitrary syscalls by calling syscall(). This allows us to work on things like syscall fuzzing. - It restricts the ability of userspace to make syscalls to a single 4KB page of code. In order to call the kernel directly, an attacker must now locate this page and call through it.
Diffstat (limited to 'Userland/Libraries/LibELF/DynamicLinker.cpp')
-rw-r--r--Userland/Libraries/LibELF/DynamicLinker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp
index dd2f61a4ef..92b790eb54 100644
--- a/Userland/Libraries/LibELF/DynamicLinker.cpp
+++ b/Userland/Libraries/LibELF/DynamicLinker.cpp
@@ -31,7 +31,6 @@
#include <AK/LexicalPath.h>
#include <AK/LogStream.h>
#include <AK/ScopeGuard.h>
-#include <Kernel/API/Syscall.h>
#include <LibC/mman.h>
#include <LibC/stdio.h>
#include <LibC/sys/internals.h>
@@ -45,6 +44,7 @@
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
+#include <syscall.h>
namespace ELF {
@@ -216,7 +216,7 @@ static NonnullRefPtr<DynamicLoader> commit_elf(const String& name)
auto object = loader->load_stage_3(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size);
ASSERT(object);
- if (name.is_one_of("libc.so", "libpthread.so", "/bin/UserspaceEmulator")) {
+ if (name == "libsystem.so") {
if (syscall(SC_msyscall, object->base_address().as_ptr())) {
ASSERT_NOT_REACHED();
}