From owner-freebsd-bugs@FreeBSD.ORG Mon Jan 16 16:53:05 2012 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20646106564A for ; Mon, 16 Jan 2012 16:53:05 +0000 (UTC) (envelope-from mcdouga9@egr.msu.edu) Received: from mail.egr.msu.edu (gribble.egr.msu.edu [35.9.37.169]) by mx1.freebsd.org (Postfix) with ESMTP id E84C98FC1B for ; Mon, 16 Jan 2012 16:53:04 +0000 (UTC) Received: from gribble (localhost [127.0.0.1]) by mail.egr.msu.edu (Postfix) with ESMTP id D40A9462EC for ; Mon, 16 Jan 2012 11:37:05 -0500 (EST) X-Virus-Scanned: amavisd-new at egr.msu.edu Received: from mail.egr.msu.edu ([127.0.0.1]) by gribble (gribble.egr.msu.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5pdySrENVoMI for ; Mon, 16 Jan 2012 11:37:05 -0500 (EST) Received: from [35.9.44.65] (daemon.egr.msu.edu [35.9.44.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mcdouga9) by mail.egr.msu.edu (Postfix) with ESMTPSA id AAA07462D9 for ; Mon, 16 Jan 2012 11:37:05 -0500 (EST) Message-ID: <4F145231.5040009@egr.msu.edu> Date: Mon, 16 Jan 2012 11:37:05 -0500 From: Adam McDougall User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: freebsd-bugs@freebsd.org References: <201112070710.pB77AAhs028194@freefall.freebsd.org> In-Reply-To: <201112070710.pB77AAhs028194@freefall.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: kern/162741: commit references a PR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jan 2012 16:53:05 -0000 On 12/07/11 02:10, dfilter service wrote: > The following reply was made to PR kern/162741; it has been noted by GNATS. > > From: dfilter@FreeBSD.ORG (dfilter service) > To: bug-followup@FreeBSD.org > Cc: > Subject: Re: kern/162741: commit references a PR > Date: Wed, 7 Dec 2011 07:03:23 +0000 (UTC) > > Author: alc > Date: Wed Dec 7 07:03:14 2011 > New Revision: 228317 > URL: http://svn.freebsd.org/changeset/base/228317 > > Log: > Eliminate the possibility of 32-bit arithmetic overflow in the calculation > of vm_kmem_size that may occur if the system administrator has specified a > vm.vm_kmem_size tunable value that exceeds the hard cap. > > PR: 162741 > Submitted by: Adam McDougall > Reviewed by: bde@ > MFC after: 3 weeks > > Modified: > head/sys/kern/kern_malloc.c > > Modified: head/sys/kern/kern_malloc.c > ============================================================================== > --- head/sys/kern/kern_malloc.c Wed Dec 7 00:22:34 2011 (r228316) > +++ head/sys/kern/kern_malloc.c Wed Dec 7 07:03:14 2011 (r228317) > @@ -740,11 +740,11 @@ kmeminit(void *dummy) > /* > * Limit kmem virtual size to twice the physical memory. > * This allows for kmem map sparseness, but limits the size > - * to something sane. Be careful to not overflow the 32bit > - * ints while doing the check. > + * to something sane. Be careful to not overflow the 32bit > + * ints while doing the check or the adjustment. > */ > - if (((vm_kmem_size / 2) / PAGE_SIZE)> cnt.v_page_count) > - vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; > + if (vm_kmem_size / 2 / PAGE_SIZE> mem_size) > + vm_kmem_size = 2 * mem_size * PAGE_SIZE; > > #ifdef DEBUG_MEMGUARD > tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); Since 9.0-RELEASE is out the door now, could this be merged to 8 and 9? Thanks!