mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-12 18:06:56 +02:00
Similar to the last commit, two page faults to the same page can happen concurrently, so we need to be able to handle this properly. Previously, we only held the VMObject's lock in AnonymousVMObject::handle_cow_fault. But as explained in the previous commit this isn't enough. We need to keep holding the lock until the page is remapped. Additionally, this commit makes handle_cow_fault() take a global lock to make concurrent page faults to the same page from different processes work correctly. This global lock is unfortunately necessary since fork() clones all VMObjects, so taking its lock won't prevent another process from handling a page fault to the same physical pages. See the FIXME comment for details. There might be a better way to fix this, but this fix should still be better than potentially panicking when concurrent COW faults occur.
15 KiB
15 KiB