kernel - Fix bug in uiomove() error handling, fix deadlock in read_shortcut
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 26 Mar 2013 23:35:56 +0000 (16:35 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 26 Mar 2013 23:35:56 +0000 (16:35 -0700)
commit862481e51f6ea1ac44befc9b9f79a0745daced2e
tree7dbc39f0d8f5e95e81afe0e67ef78415db05e559
parent2b43b38c68c01a4d17f2ba59e144975f1155bab8
kernel - Fix bug in uiomove() error handling, fix deadlock in read_shortcut

* Fix a recently introduced bug in uiomove() related to error handling
  when iovcnt is greater than 1.

* Fix a deadlock in the vm.read_shortcut code, rare triggerable except
  by vkernels.

  The deadlock is due to a busied VM page being held across a uiomove().
  To fix a new function uiomove_nofault() was added which causes EFAULT
  to be returned for any non-trivial VM fault (any fault related to nested
  objects or vnode objects).

  The vop_helper_read_shortcut() procedure uses this new uiomove function
  and breaks out when the case occurs, returning and falling through to
  the filesystem's normal buffer-cache-based read() code.

* As an added bonus, we no longer have to unlock the VM object across
  the new uiomove_nofault() call in the read shorcut code, since it is
  no longer possible to deadlock against the VM object.

Reported-by: tuxillo
sys/kern/kern_subr.c
sys/kern/vfs_helper.c
sys/sys/thread.h
sys/sys/uio.h
sys/vm/vm_fault.c