1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Kernel: Disallow syscalls from writeable memory

Processes will now crash with SIGSEGV if they attempt making a syscall
from PROT_WRITE memory.

This neat idea comes from OpenBSD. :^)
This commit is contained in:
Andreas Kling 2019-11-29 16:15:30 +01:00
parent ea52fe528a
commit e56daf547c
5 changed files with 27 additions and 5 deletions

View file

@ -1,6 +1,5 @@
#pragma once
#include <AK/String.h>
#include <AK/Badge.h>
#include <AK/Bitmap.h>
#include <AK/ByteBuffer.h>
@ -8,6 +7,7 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <AK/Types.h>
#include <AK/Vector.h>
#include <AK/Weakable.h>
@ -79,6 +79,9 @@ public:
}
}
static Region* region_from_vaddr(Process&, VirtualAddress);
static const Region* region_from_vaddr(const Process&, VirtualAddress);
private:
MemoryManager(u32 physical_address_for_kernel_page_tables);
~MemoryManager();
@ -96,9 +99,6 @@ private:
void create_identity_mapping(PageDirectory&, VirtualAddress, size_t length);
static Region* region_from_vaddr(Process&, VirtualAddress);
static const Region* region_from_vaddr(const Process&, VirtualAddress);
static Region* user_region_from_vaddr(Process&, VirtualAddress);
static Region* kernel_region_from_vaddr(VirtualAddress);