mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +00:00
Kernel/Process: Move protected values to the end of the object
The compiler can re-order the structure (class) members if that's necessary, so if we make Process to inherit from ProcFSExposedComponent, even if the declaration is to inherit first from ProcessBase, then from ProcFSExposedComponent and last from Weakable<Process>, the members of class ProcFSExposedComponent (including the Ref-counted parts) are the first members of the Process class. This problem made it impossible to safely use the current toggling method with the write-protection bit on the ProcessBase members, so instead of inheriting from it, we make its members the last ones in the Process class so we can safely locate and modify the corresponding page write protection bit of these values. We make sure that the Process class doesn't expand beyond 8192 bytes and the protected values are always aligned on a page boundary.
This commit is contained in:
parent
e405f436b6
commit
01b79910b3
12 changed files with 130 additions and 128 deletions
|
@ -40,7 +40,7 @@ KResultOr<FlatPtr> Process::sys$setsid()
|
|||
m_pg = ProcessGroup::create(ProcessGroupID(pid().value()));
|
||||
m_tty = nullptr;
|
||||
ProtectedDataMutationScope scope { *this };
|
||||
m_sid = pid().value();
|
||||
m_protected_values.sid = pid().value();
|
||||
return sid().value();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue