Page MenuHomeFreeBSD

Fix a race in release_page().
ClosedPublic

Authored by markj on Nov 4 2019, 4:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 3:41 PM
Unknown Object (File)
Oct 2 2024, 10:10 AM
Unknown Object (File)
Sep 29 2024, 11:50 AM
Unknown Object (File)
Sep 29 2024, 1:17 AM
Unknown Object (File)
Sep 8 2024, 11:48 AM
Unknown Object (File)
Aug 31 2024, 6:49 AM
Unknown Object (File)
Aug 18 2024, 3:15 AM
Unknown Object (File)
Jul 29 2024, 2:48 AM
Subscribers

Details

Summary

Since r354156 we may call release_page() without the page's object's
lock held. Specifically, this happens following the page copy in a CoW
fault. release_page() must therefore unbusy the page only after calling
vm_page_deactivate(). Otherwise, nothing prevents the page from being
freed after the unbusy, and vm_page_deactivate() does not handle races
with vm_page_free_prep().

I do not think there is any harm in keeping the page busy across the
requeue: vm_page_deactivate() moves the page to the tail of the queue,
where the page daemon is not likely to see it before the unbusy is
performed.

Add some assertions to various queue manipulation functions that are
useful for catching this type of bug.

Test Plan

Peter is testing the patch.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable