mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:14:58 +00:00
![]() Previously we had a race condition in the page fault handling: We were relying on the affected Region staying alive while handling the page fault, but this was not actually guaranteed, as an munmap from another thread could result in the region being removed concurrently. This commit closes that hole by extending the lifetime of the region affected by the page fault until the handling of the page fault is complete. This is achieved by maintaing a psuedo-reference count on the region which counts the number of in-progress page faults being handled on this region, and extending the lifetime of the region while this counter is non zero. Since both the increment of the counter by the page fault handler and the spin loop waiting for it to reach 0 during Region destruction are serialized using the appropriate AddressSpace spinlock, eventual progress is guaranteed: As soon as the region is removed from the tree no more page faults on the region can start. And similarly correctness is ensured: The counter is incremented under the same lock, so any page faults that are being handled will have already incremented the counter before the region is deallocated. |
||
---|---|---|
.. | ||
AddressSpace.cpp | ||
AddressSpace.h | ||
AllocationStrategy.h | ||
AnonymousVMObject.cpp | ||
AnonymousVMObject.h | ||
InodeVMObject.cpp | ||
InodeVMObject.h | ||
MappedROM.h | ||
MemoryManager.cpp | ||
MemoryManager.h | ||
PageFaultResponse.h | ||
PhysicalPage.cpp | ||
PhysicalPage.h | ||
PhysicalRegion.cpp | ||
PhysicalRegion.h | ||
PhysicalZone.cpp | ||
PhysicalZone.h | ||
PrivateInodeVMObject.cpp | ||
PrivateInodeVMObject.h | ||
Region.cpp | ||
Region.h | ||
RegionTree.cpp | ||
RegionTree.h | ||
RingBuffer.cpp | ||
RingBuffer.h | ||
ScatterGatherList.cpp | ||
ScatterGatherList.h | ||
ScopedAddressSpaceSwitcher.cpp | ||
ScopedAddressSpaceSwitcher.h | ||
SharedFramebufferVMObject.cpp | ||
SharedFramebufferVMObject.h | ||
SharedInodeVMObject.cpp | ||
SharedInodeVMObject.h | ||
TypedMapping.h | ||
VirtualRange.cpp | ||
VirtualRange.h | ||
VMObject.cpp | ||
VMObject.h |