git: vkernel - Fix more pagein/pageout corruption

Matthew Dillon dillon at
Sat Feb 4 21:10:25 PST 2017

commit fc531fbc3f1e79529ed3c8b6f4a7a528932afd33
Author: Matthew Dillon <dillon at>
Date:   Sat Feb 4 21:06:40 2017 -0800

    vkernel - Fix more pagein/pageout corruption
    * There is a race when the real kernel walks a virtual page
      table (VPAGETABLE) as created by a vkernel managing various
      contexts.  The real kernel may complete the lookup but get
      interrupted by a pmap invalidation BEFORE it enters the results
      into the pmap.  The result is that the pmap invalidation is not
      applied to the PTE entered into the pmap, leading to data corruption.
    * Fix with a bit of a hack for now.  Lock the VA in vm_fault and lock
      the VA in MADV_INVAL operations (which is what the vkernel uses to
      invalidate the pmap).  This closes the hole.
    * This race has to be fixed in the real kernel but normal programs outside
      of a vkernel are not affected by it because they don't use VPAGETABLE
    * buildworld -j many in an intentionally hard-paging vkernel now completes
      without error.

Summary of changes:
 sys/platform/vkernel64/x86_64/trap.c |  9 +++--
 sys/vm/vm_fault.c                    | 20 +++++++++--
 sys/vm/vm_map.c                      | 68 ++++++++++++++++++++++++++++++++++--
 sys/vm/vm_map.h                      | 19 ++++++++++
 4 files changed, 109 insertions(+), 7 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list