mirror of
https://github.com/RGBCube/serenity
synced 2026-01-12 23:31:01 +00:00
Kernel: Ensure that the ProcessBase class is properly laid out on x86_64
Without this the ProcessBase class is placed into the padding for the
ProtectedProcessBase class which then causes the members of the
RefCounted class to end up without the first 4096 bytes of the Process
class:
BP 1, Kernel::Process::protect_data (this=this@entry=0xc063b000)
205 {
(gdb) p &m_ref_count
$1 = (AK::Atomic<unsigned int, (AK::MemoryOrder)5> *) 0xc063bffc
Note how the difference between 'this' and &m_ref_count is less than
4096.
This commit is contained in:
parent
9077c64d37
commit
409b874514
1 changed files with 4 additions and 1 deletions
|
|
@ -109,7 +109,10 @@ protected:
|
|||
|
||||
class ProcessBase : public ProtectedProcessBase {
|
||||
protected:
|
||||
u8 m_process_base_padding[PAGE_SIZE - sizeof(ProtectedProcessBase)];
|
||||
// Without the alignas specifier here the compiler places this class into
|
||||
// the parent class' padding which then causes the members for the RefCounted
|
||||
// class to be placed within the first page of the Process class.
|
||||
alignas(ProtectedProcessBase) u8 m_process_base_padding[PAGE_SIZE - sizeof(ProtectedProcessBase)];
|
||||
};
|
||||
|
||||
static_assert(sizeof(ProcessBase) == PAGE_SIZE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue