NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56911: uvm_vslock fails to block munmap

>Number:         56911
>Category:       kern
>Synopsis:       uvm_vslock fails to block munmap
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 04 16:25:00 +0000 2022
>Originator:     Taylor R Campbell
>Release:        NetBSD-current
Th NtBSD Fndtn
ruled unconstitutional by SCOTUS, 6-3
Some kernel systems -- such as genfs_directio, mincore(2), and MI _ucas_32/_ucas_64 -- rely on uvm_vslock to lock virtual address mappings to physical pages, so that, e.g., pmap_extract will succeed:

uvm_vslock does prevent the pages from being swapped.  However, it does not prevent concurrent munmap(2) from unmapping them, or concurrent mremap(2) from remapping them.
munmap (or mmap, or mremap) a virtual address range concurrently with a read/write on a file opened O_DIRECT, or concurrently with mincore(2), or concurrently with futex(2).

Example crashes with reproducer:
Yes please!

mmap/munmap/mremap must block until the virtual address range in question is released by uvm_vsunlock.  This should be a reasonably short duration -- unless uvm_vslock is blocking waiting for swapping -- because once the pages are locked no more I/O should be happening.

Home | Main Index | Thread Index | Old Index