Fix the deadlock between uvn_io() and uvn_flush() by restarting the fault.
authormpi <mpi@openbsd.org>
Tue, 12 Oct 2021 07:38:22 +0000 (07:38 +0000)
committermpi <mpi@openbsd.org>
Tue, 12 Oct 2021 07:38:22 +0000 (07:38 +0000)
commitd6b79e511bc936dc4cfc4406b11100861ddd6e7c
tree19661c5eaa60de57d0564b58c8d3c4b8f81413ee
parent8542cb70f46edc65cef663d50716b9d52666c4ea
Fix the deadlock between uvn_io() and uvn_flush() by restarting the fault.

Do not allow a faulting thread to sleep on a contended vnode lock to prevent
lock ordering issues with upcoming per-uobj lock.

Also reduce the sleep value for VM_PAGER_AGAIN from 1sec to 5nsec to not add
visible slowdown when starting a multi-threaded application with threads that
fault on the same vnode (chromium, firefox, etc).

Tested by anton@, tb@, robert@ and gnezdo@

ok anton@, tb@

Reported-by: syzbot+e63407b35dff08dbee02@syzkaller.appspotmail.com
sys/uvm/uvm_fault.c
sys/uvm/uvm_pager.h
sys/uvm/uvm_vnode.c