mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
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.
This commit is contained in:
parent
4df3a34bc2
commit
e87eac9273
47 changed files with 164 additions and 47 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue