Is expand_stack buggy wrt locked_vm?
I think there might be a problem with the way expand_stack updates locked_vm.
Assume the kernel is trying to copyout some amount(512b) of data into the user's stack, and the underlying pages are not yet allocated, and the stack is marked VM_LOCKED. The page fault will trigger an expand_stack, which will update the locked_vm by an amount depending on where the kernel is trying to write out the data. Back in the fault handling code, handle_mm_fault will allocate just one page and be done. So, although the process has incremented its number of locked pages by 1, expand_stack has updated locked_vm by a possibly bigger amount.
I think the right fix is for expand_stack to fault in all the intermediate pages, by something like
if (vma->vm_flags & VM_LOCKED) {
make_pages_present(address, old vma->vm_start);
}Comments?
Kanoj
[email protected]
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address' in the body to [email protected]. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/