Konstantin Belousov 79e9552ebb Check for wrap-around in vm_phys_alloc_seg_contig().
It is possible to provide insane values for size in contigmalloc(9)
request, which usually not reaches the phys allocator due to failing
KVA allocation.  But with the forthcoming 4/4 i386, where 32bit
architecture has almost 4G KVA, contigmalloc(1G) is not unreasonable
outright and KVA might be available sometimes.

Then, the calculation of pa_end could wrap around, depending on the
physical address, and the checks in vm_phys_alloc_seg_contig() would
pass while the iteration in the loop after the 'done' label goes out
of the vm_page_array bounds.

Fix it by detecting the wrap.

Reported and tested by:	pho
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D14767
2018-03-20 16:17:55 +00:00
..
2018-03-17 17:18:29 +00:00
2018-03-18 03:42:57 +00:00
2018-03-17 12:59:55 +00:00
2018-03-20 15:51:05 +00:00
2018-02-14 00:12:03 +00:00
2018-03-11 19:14:01 +00:00
2018-02-08 20:09:42 +00:00
2018-03-20 15:51:05 +00:00
2018-03-17 12:59:55 +00:00
2018-03-19 17:14:56 +00:00