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)
Thu, Mar 28, 1:23 PM
Unknown Object (File)
Mar 7 2024, 11:36 PM
Unknown Object (File)
Dec 31 2023, 4:53 AM
Unknown Object (File)
Dec 23 2023, 9:45 AM
Unknown Object (File)
Nov 8 2023, 12:44 AM
Unknown Object (File)
Jul 27 2023, 6:32 PM
Unknown Object (File)
Jul 10 2023, 10:14 AM
Unknown Object (File)
Jul 8 2023, 12:53 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27336
Build 25587: arc lint + arc unit