Author: kib
Date: Wed Nov 22 16:45:27 2017
New Revision: 326098
URL: https://svnweb.freebsd.org/changeset/base/326098

Log:
  Return different error code for the guard page layout violation.
  
  On KERN_NO_SPACE error, as it is returned now, vm_map_find() continues
  the loop searching for the suitable range for the requested mapping
  with specific alignment.  Since the vm_map_findspace() succesfully
  finds the same place, the loop never ends.
  
  The errors returned from vm_map_stack() completely repeat the behavior
  of vm_map_insert() now, as suggested by Alan.
  
  Reported by:  Arto Pekkanen <aks...@gmail.com>
  PR:   223732
  Reviewed by:  alc, markj
  Discussed with:       jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:    3 days
  Differential revision:        https://reviews.freebsd.org/D13186

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c        Wed Nov 22 16:39:24 2017        (r326097)
+++ head/sys/vm/vm_map.c        Wed Nov 22 16:45:27 2017        (r326098)
@@ -3612,12 +3612,13 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos,
        KASSERT(orient != (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP),
            ("bi-dir stack"));
 
-       sgp = (vm_size_t)stack_guard_page * PAGE_SIZE;
        if (addrbos < vm_map_min(map) ||
-           addrbos > vm_map_max(map) ||
-           addrbos + max_ssize < addrbos ||
-           sgp >= max_ssize)
-               return (KERN_NO_SPACE);
+           addrbos + max_ssize > vm_map_max(map) ||
+           addrbos + max_ssize <= addrbos)
+               return (KERN_INVALID_ADDRESS);
+       sgp = (vm_size_t)stack_guard_page * PAGE_SIZE;
+       if (sgp >= max_ssize)
+               return (KERN_INVALID_ARGUMENT);
 
        init_ssize = growsize;
        if (max_ssize < init_ssize + sgp)
_______________________________________________
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