[Bug 273610] Panic (vm_page_assert_xbusied: page 0xfffffe0001beaed8 busy_lock 0xfffffffe not owned by me)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 02 Oct 2023 11:51:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273610

--- Comment #7 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=e61568aeeec7667789e6c9d4837e074edecc990e

commit e61568aeeec7667789e6c9d4837e074edecc990e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-02 11:49:27 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-02 11:49:52 +0000

    swap_pager: Fix a race in swap_pager_swapoff_object()

    When we disable swapping to a device, we scan the full VM object list
    looking for objects with swap trie nodes that reference the device in
    question.  The pages corresponding to those nodes are paged in.

    While paging in, we drop the VM object lock.  Moreover, we do not hold a
    reference for the object; swap_pager_swapoff_object() merely bumps the
    paging-in-progress counter.  vm_object_terminate() waits for this
    counter to drain before proceeding and freeing pages.

    However, swap_pager_swapoff_object() decrements the counter before
    re-acquiring the VM object lock, which means that vm_object_terminate()
    can race to acquire the lock and free the pages.  Then,
    swap_pager_swapoff_object() ends up unbusying a freed page.  Fix the
    problem by acquiring the lock before waking up sleepers.

    PR:             273610
    Reported by:    Graham Perrin <grahamperrin@gmail.com>
    Reviewed by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D42029

 sys/vm/swap_pager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.