git: DragonFly_RELEASE_4_2 kernel - Fix mlock() related panic and memory leak

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Aug 16 23:11:06 PDT 2015


commit a6b314a54dbda943dc16afe9b281880cb69b0b6f
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Jul 12 21:07:55 2015 -0700

    kernel - Fix mlock() related panic and memory leak
    
    * If a process exits with mlock()d pages, the pages are left wired,
      causing an immediate memory leak and also leading to an assertion
      and panic later on when the kernel tries to free the pages.
    
    * The problem is due to an exit optimization which calls
      pmap_remove_pages() before deleting the mappings.  vm_fault_unwire()
      expects the pmap to have the pages and fails to properly adjust the
      wire count when it doesn't.
    
    * Fixed by testing pmap->pm_stats.wired_count and shifting the
      pmap_remove_pages() call to after the maps are removed if it is
      non-zero.
    
    Reported-by: marino via muscles panic

Summary of changes:
 sys/vm/vm_map.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a6b314a54dbda943dc16afe9b281880cb69b0b6f


-- 
DragonFly BSD source repository



More information about the Commits mailing list