mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Kernel: Don't unregister Region from RegionTree *before* unmapping it
If we unregister from the RegionTree before unmapping, there's a race where a new region can get inserted at the same address that we're about to unmap. If this happens, ~Region() will then unmap the newly inserted region, which now finds itself with cleared-out page table entries.
This commit is contained in:
parent
a3db0ab14f
commit
0a83c03546
1 changed files with 3 additions and 3 deletions
|
@ -64,9 +64,6 @@ Region::~Region()
|
|||
|
||||
m_vmobject->remove_region(*this);
|
||||
|
||||
if (is_kernel())
|
||||
MM.unregister_kernel_region(*this);
|
||||
|
||||
if (m_page_directory) {
|
||||
SpinlockLocker pd_locker(m_page_directory->get_lock());
|
||||
if (!is_readable() && !is_writable() && !is_executable()) {
|
||||
|
@ -77,6 +74,9 @@ Region::~Region()
|
|||
VERIFY(!m_page_directory);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_kernel())
|
||||
MM.unregister_kernel_region(*this);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<Region>> Region::create_unbacked()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue