Date: Sat, 10 Dec 2011 18:42:00 +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: r228398 - head/sys/i386/include Message-ID: <201112101842.pBAIg01W017533@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Sat Dec 10 18:42:00 2011 New Revision: 228398 URL: http://svn.freebsd.org/changeset/base/228398 Log: Avoid the possibility of integer overflow in the calculation of VM_KMEM_SIZE_MAX. Specifically, if the user/kernel address space split was changed such that the kernel address space was greater than or equal to 2 GB, then overflow would occur. PR: 161721 MFC after: 3 weeks Modified: head/sys/i386/include/vmparam.h Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Dec 10 18:35:26 2011 (r228397) +++ head/sys/i386/include/vmparam.h Sat Dec 10 18:42:00 2011 (r228398) @@ -186,11 +186,12 @@ #endif /* - * Ceiling on amount of kmem_map kva space. + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space + * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS) * 2 / 5) +#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ + VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) #endif /* initial pagein size of beginning of executable file */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112101842.pBAIg01W017533>