Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2010 04:51:07 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r215370 - stable/7/sys/vm
Message-ID:  <201011160451.oAG4p7d8039856@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue Nov 16 04:51:07 2010
New Revision: 215370
URL: http://svn.freebsd.org/changeset/base/215370

Log:
  MFC r214953
    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.

Modified:
  stable/7/sys/vm/vm_map.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/vm/vm_map.c
==============================================================================
--- stable/7/sys/vm/vm_map.c	Tue Nov 16 04:40:27 2010	(r215369)
+++ stable/7/sys/vm/vm_map.c	Tue Nov 16 04:51:07 2010	(r215370)
@@ -2927,7 +2927,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?201011160451.oAG4p7d8039856>