diff options
author | Hugh Dickins <hugh@veritas.com> | 2009-04-16 16:58:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-16 17:41:25 -0400 |
commit | 05fa199d45c54a9bda7aa3ae6537253d6f097aa9 (patch) | |
tree | cfdcdd04bfcef7d0dcb47fad93ba8fa676349dd3 | |
parent | 05f54c13cd0c33694eec39a265475c5d6cf223cf (diff) |
mm: pass correct mm when growing stack
Tetsuo Handa reports seeing the WARN_ON(current->mm == NULL) in
security_vm_enough_memory(), when do_execve() is touching the
target mm's stack, to set up its args and environment.
Yes, a UMH_NO_WAIT or UMH_WAIT_PROC call_usermodehelper() spawns
an mm-less kernel thread to do the exec. And in any case, that
vm_enough_memory check when growing stack ought to be done on the
target mm, not on the execer's mm (though apart from the warning,
it only makes a slight tweak to OVERCOMMIT_NEVER behaviour).
Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/mmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1575,7 +1575,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns | |||
1575 | * Overcommit.. This must be the final test, as it will | 1575 | * Overcommit.. This must be the final test, as it will |
1576 | * update security statistics. | 1576 | * update security statistics. |
1577 | */ | 1577 | */ |
1578 | if (security_vm_enough_memory(grow)) | 1578 | if (security_vm_enough_memory_mm(mm, grow)) |
1579 | return -ENOMEM; | 1579 | return -ENOMEM; |
1580 | 1580 | ||
1581 | /* Ok, everything looks good - let it rip */ | 1581 | /* Ok, everything looks good - let it rip */ |