mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	arjan@linux.intel.com, gregkh@suse.de, alan@lxorguk.ukuu.org.uk,
	viro@ZenIV.linux.org.uk, jmorris@namei.org,
	akpm@linux-foundation.org, paulmck@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mm: pass correct mm when growing stack
Date: Thu, 16 Apr 2009 21:58:12 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0904162156310.645@blonde.anvils> (raw)
In-Reply-To: <Pine.LNX.4.64.0904162145130.645@blonde.anvils>

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
---
Commoner in 2.6.30-rc, but needs fixing in 2.6.28.N and 2.6.29.N too.

 mm/mmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 2.6.30-rc2/mm/mmap.c	2009-04-08 18:20:25.000000000 +0100
+++ linux/mm/mmap.c	2009-04-16 20:31:17.000000000 +0100
@@ -1575,7 +1575,7 @@ static int acct_stack_growth(struct vm_a
 	 * Overcommit..  This must be the final test, as it will
 	 * update security statistics.
 	 */
-	if (security_vm_enough_memory(grow))
+	if (security_vm_enough_memory_mm(mm, grow))
 		return -ENOMEM;
 
 	/* Ok, everything looks good - let it rip */

  reply	other threads:[~2009-04-16 21:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  0:57 [2.6.30-rc1] RCU detected CPU 1 stall Tetsuo Handa
2009-04-10 14:22 ` Paul E. McKenney
2009-04-10 15:03   ` Al Viro
2009-04-10 15:32     ` Paul E. McKenney
2009-04-10 21:08       ` Tetsuo Handa
2009-04-10 23:12         ` Paul E. McKenney
2009-04-10 23:39           ` Al Viro
2009-04-11  0:48             ` Paul E. McKenney
2009-04-13  0:48             ` Tetsuo Handa
2009-04-13 19:55               ` Paul E. McKenney
2009-04-13 21:31                 ` Tetsuo Handa
2009-04-13 22:47                   ` Paul E. McKenney
2009-04-14 17:11               ` Hugh Dickins
2009-04-15  3:28                 ` Tetsuo Handa
2009-04-15 20:34                   ` Hugh Dickins
2009-04-16  0:46                     ` Tetsuo Handa
2009-04-16  5:15                       ` Hugh Dickins
2009-04-16  5:35                         ` Tetsuo Handa
2009-04-16 20:37                           ` Greg KH
2009-04-16 20:55                           ` Please revert kobject_uevent UMH_NO_WAIT Hugh Dickins
2009-04-16 20:58                             ` Hugh Dickins [this message]
2009-04-16 21:24                             ` Greg KH
2009-04-16 21:30                               ` Arjan van de Ven
2009-04-16 21:36                                 ` Will Newton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0904162156310.645@blonde.anvils \
    --to=hugh@veritas.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®