vm: Fix vm_map_find_min()

Fix the handling of address hints that are less than min_addr by
vm_map_find_min().

Reported by:	dchagin
Reviewed by:	kib
Fixes:	d8e6f4946c "vm: Fix anonymous memory clustering under ASLR"
Differential Revision:	https://reviews.freebsd.org/D41159
This commit is contained in:
Alan Cox 2023-07-25 02:24:19 -05:00
parent d059e44b80
commit 50d663b14b

View File

@ -2255,10 +2255,10 @@ vm_map_find_min(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
int rv;
hint = *addr;
if (hint == 0)
if (hint == 0) {
cow |= MAP_NO_HINT;
if (hint < min_addr)
*addr = hint = min_addr;
}
for (;;) {
rv = vm_map_find(map, object, offset, addr, length, max_addr,
find_space, prot, max, cow);