mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 21:31:40 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/90c0f9664ea
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user