mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05: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
Notes:
sideshowbarker
2024-07-18 11:29:42 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/409b8745149 Pull-request: https://github.com/SerenityOS/serenity/pull/8256 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/awesomekling
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
Reference in a new issue