diff options
author | alc <alc@FreeBSD.org> | 2011-12-10 18:42:00 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2011-12-10 18:42:00 +0000 |
commit | 57f34640a0a11883a79979db53201f8781ff0edf (patch) | |
tree | 7006470e4e50318511d48099c14be8161f8ced78 /sys/i386 | |
parent | 71c254bdb3ff5cc5a01a43eb10a5da8c112b64c0 (diff) | |
download | FreeBSD-src-57f34640a0a11883a79979db53201f8781ff0edf.zip FreeBSD-src-57f34640a0a11883a79979db53201f8781ff0edf.tar.gz |
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
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/include/vmparam.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 8fe9b2b..56ab4b3 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -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 */ |