Unionfs: prevent races in unionfs_fault
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 17:05:52 +0000 (13:05 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 24 Nov 2013 19:25:08 +0000 (14:25 -0500)
commit0637f59a5a8b1f2ed22b8ad7c87ff7a514e3b72b
treee303c84c29b34d8d89d1d0101957804092a94316
parenta66101d3e5f493c23fe47d51d026521d96cc7292
Unionfs: prevent races in unionfs_fault

vm_ops->fault may be called in parallel.  Because we have to resort to
temporarily changing the vma->vm_file to point to the lower file, a
concurrent invocation of unionfs_fault could see a different value.  In this
workaround, we keep a different copy of the vma structure in our stack, so
we never expose a different value of the vma->vm_file called to us, even
temporarily.  A better fix (already tested) would be to change the calling
semantics of ->fault to take an explicit file pointer.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/mmap.c