git: kernel - Fix bug in uiomove() error handling, fix deadlock in read_shortcut

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Mar 26 16:42:26 PDT 2013


commit 862481e51f6ea1ac44befc9b9f79a0745daced2e
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Mar 26 16:35:56 2013 -0700

    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

Summary of changes:
 sys/kern/kern_subr.c  | 39 +++++++++++++++++++++++++++++++--------
 sys/kern/vfs_helper.c | 20 ++++++++++++++------
 sys/sys/thread.h      |  1 +
 sys/sys/uio.h         |  1 +
 sys/vm/vm_fault.c     | 40 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 87 insertions(+), 14 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/862481e51f6ea1ac44befc9b9f79a0745daced2e


-- 
DragonFly BSD source repository



More information about the Commits mailing list