Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Nov 2010 21:40:34 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214953 - head/sys/vm
Message-ID:  <201011072140.oA7LeY8j084696@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Nov  7 21:40:34 2010
New Revision: 214953
URL: http://svn.freebsd.org/changeset/base/214953

Log:
  In case the stack size reaches its limit and its growth must be restricted,
  ensure that grow_amount is a multiple of the page size.  Otherwise, the
  kernel may crash in swap_reserve_by_uid() on HEAD and FreeBSD 8.x, and
  produce a core file with a missing stack on FreeBSD 7.x.
  
  Diagnosed and reported by: jilles
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Sun Nov  7 20:56:41 2010	(r214952)
+++ head/sys/vm/vm_map.c	Sun Nov  7 21:40:34 2010	(r214953)
@@ -3338,7 +3338,8 @@ Retry:
 	if (grow_amount > stack_entry->avail_ssize)
 		grow_amount = stack_entry->avail_ssize;
 	if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) {
-		grow_amount = stacklim - ctob(vm->vm_ssize);
+		grow_amount = trunc_page((vm_size_t)stacklim) -
+		    ctob(vm->vm_ssize);
 	}
 
 	/* If we would blow our VMEM resource limit, no go */



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