Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2019 16:48:20 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350758 - head/sys/vm
Message-ID:  <201908081648.x78GmKe7049809@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Aug  8 16:48:19 2019
New Revision: 350758
URL: https://svnweb.freebsd.org/changeset/base/350758

Log:
  Fix stack grow for init.
  
  During early stages of kern_exec(), including strings copyout,
  p_textvp for init is NULL.  This prevented stack grow from working for
  init execution.
  
  Without stack gap enabled, initial stack segment size is enough for
  strings passed by kernel to init.  With the gap enabled, the used
  address might fall out of the initial segment, which kills init.
  
  Exclude initproc from the check for contexts which should not cause
  stack grow in the target map.
  
  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	Thu Aug  8 16:42:53 2019	(r350757)
+++ head/sys/vm/vm_map.c	Thu Aug  8 16:48:19 2019	(r350758)
@@ -4217,7 +4217,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma
 	 * 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)
+	if (p != initproc && (map != &p->p_vmspace->vm_map ||
+	    p->p_textvp == NULL))
 		return (KERN_FAILURE);
 
 	MPASS(!map->system_map);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908081648.x78GmKe7049809>