Author: dougm
Date: Tue Jun 25 07:44:37 2019
New Revision: 349363
URL: https://svnweb.freebsd.org/changeset/base/349363

Log:
  vm_map_protect may return an INVALID_ARGUMENT or PROTECTION_FAILURE
  error response after clipping the first map entry in the region to be
  reserved. This creates a pair of matching entries that should have
  been "simplified" back into one, or never created. This change defers
  the clipping of that entry until those two vm_map_protect failure
  cases have been ruled out.
  
  Reviewed by: alc
  Approved by: markj (mentor)
  Differential Revision: https://reviews.freebsd.org/D20711

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c        Tue Jun 25 07:04:47 2019        (r349362)
+++ head/sys/vm/vm_map.c        Tue Jun 25 07:44:37 2019        (r349363)
@@ -2472,11 +2472,8 @@ again:
 
        VM_MAP_RANGE_CHECK(map, start, end);
 
-       if (vm_map_lookup_entry(map, start, &entry)) {
-               vm_map_clip_start(map, entry, start);
-       } else {
+       if (!vm_map_lookup_entry(map, start, &entry))
                entry = entry->next;
-       }
 
        /*
         * Make a first pass to check for protection violations.
@@ -2515,6 +2512,7 @@ again:
         * now will do cow due to allowed write (e.g. debugger sets
         * breakpoint on text segment)
         */
+       vm_map_clip_start(map, entry, start);
        for (current = entry; current->start < end; current = current->next) {
 
                vm_map_clip_end(map, current, end);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to