Rounding addr upwards to next 4M or 2M boundary in pmap_growkernel() could
cause addr to become 0, resulting in an early return without populating the last PDE. Reviewed by: alc
This commit is contained in:
parent
f985eb97d4
commit
6bd7e81d83
@ -1387,12 +1387,22 @@ pmap_growkernel(vm_offset_t addr)
|
||||
while (pdir_pde(PTD, kernel_vm_end)) {
|
||||
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
|
||||
nkpt++;
|
||||
if (kernel_vm_end - 1 >= kernel_map->max_offset) {
|
||||
kernel_vm_end = kernel_map->max_offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
addr = roundup2(addr, PAGE_SIZE * NPTEPG);
|
||||
if (addr - 1 >= kernel_map->max_offset)
|
||||
addr = kernel_map->max_offset;
|
||||
while (kernel_vm_end < addr) {
|
||||
if (pdir_pde(PTD, kernel_vm_end)) {
|
||||
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
|
||||
if (kernel_vm_end - 1 >= kernel_map->max_offset) {
|
||||
kernel_vm_end = kernel_map->max_offset;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1418,6 +1428,10 @@ pmap_growkernel(vm_offset_t addr)
|
||||
}
|
||||
mtx_unlock_spin(&allpmaps_lock);
|
||||
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
|
||||
if (kernel_vm_end - 1 >= kernel_map->max_offset) {
|
||||
kernel_vm_end = kernel_map->max_offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user