svn commit: r321230 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Wed Jul 19 19:00:34 UTC 2017


Author: kib
Date: Wed Jul 19 19:00:32 2017
New Revision: 321230
URL: https://svnweb.freebsd.org/changeset/base/321230

Log:
  Disable stack growth when accessed by AIO daemons.
  
  Commit message for r321173 incorrectly stated that the change disables
  automatic stack growth from the AIO daemons contexts, with explanation
  that this is currently prevents applying wrong resource limits.  Fix
  this by actually disabling the growth.
  
  Noted by:	alc
  Reviewed by:	alc, jhb
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Wed Jul 19 18:59:26 2017	(r321229)
+++ head/sys/vm/vm_map.c	Wed Jul 19 19:00:32 2017	(r321230)
@@ -3698,8 +3698,15 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma
 
 	p = curproc;
 	vm = p->p_vmspace;
-	if (map != &p->p_vmspace->vm_map)
+
+	/*
+	 * Disallow stack growth when the access is performed by a
+	 * debugger or AIO daemon.  The reason is that the wrong
+	 * resource limits are applied.
+	 */
+	if (map != &p->p_vmspace->vm_map || p->p_textvp == NULL)
 		return (KERN_FAILURE);
+
 	MPASS(!map->system_map);
 
 	guard = stack_guard_page * PAGE_SIZE;


More information about the svn-src-head mailing list