diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-11 13:13:05 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-11 14:21:49 +0100 |
commit | 90c0f9664ea96d3d4c23eaba8a431f6e57db9e6c (patch) | |
tree | a9799a005e26b6d4c94083bd75f23b3b723076c4 /Kernel/Syscalls/process.cpp | |
parent | 4fcc637e29104f543c1bf278cc2481bfeb9ea3fa (diff) | |
download | serenity-90c0f9664ea96d3d4c23eaba8a431f6e57db9e6c.zip |
Kernel: Don't keep protected Process data in a separate allocation
The previous architecture had a huge flaw: the pointer to the protected
data was itself unprotected, allowing you to overwrite it at any time.
This patch reorganizes the protected data so it's part of the Process
class itself. (Actually, it's a new ProcessBase helper class.)
We use the first 4 KB of Process objects themselves as the new storage
location for protected data. Then we make Process objects page-aligned
using MAKE_ALIGNED_ALLOCATED.
This allows us to easily turn on/off write-protection for everything in
the ProcessBase portion of Process. :^)
Thanks to @bugaevc for pointing out the flaw! This is still not perfect
but it's an improvement.
Diffstat (limited to 'Kernel/Syscalls/process.cpp')
-rw-r--r-- | Kernel/Syscalls/process.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Syscalls/process.cpp b/Kernel/Syscalls/process.cpp index 06301d94f6..e604641965 100644 --- a/Kernel/Syscalls/process.cpp +++ b/Kernel/Syscalls/process.cpp @@ -38,7 +38,7 @@ KResultOr<pid_t> Process::sys$getpid() KResultOr<pid_t> Process::sys$getppid() { REQUIRE_PROMISE(stdio); - return protected_data().ppid.value(); + return m_ppid.value(); } KResultOr<int> Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) |