All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Byrne <john.l.byrne@hp.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Still a mm bug in the fork error path
Date: Tue, 12 Oct 2004 20:27:45 -0700	[thread overview]
Message-ID: <416CA0B1.20900@hp.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0410121902100.3897@ppc970.osdl.org>

Linus Torvalds wrote:
> 
> On Tue, 12 Oct 2004, John Byrne wrote:
> 
>>@@ -1104,9 +1146,7 @@
>>  bad_fork_cleanup_namespace:
>>  	exit_namespace(p);
>>  bad_fork_cleanup_mm:
>>-	exit_mm(p);
>>-	if (p->active_mm)
>>-		mmdrop(p->active_mm);
>>+	mmput(p->mm);
>>  bad_fork_cleanup_signal:
>>  	exit_signal(p);
>>  bad_fork_cleanup_sighand:
>>
>>However, the new code will panic if the thread being forked is a process 
>>with a NULL mm. It looks very unlikely to be hit in the real world, but 
>>it is possible.
> 
> 
> Hmm.. How does it happen? As far as I can tell, we only get here if
>  - copy_thread or copy_namespaces had an error
> and "mm" can be NULL only for kernel threads.
> 
> Now, I don't think any kernel threads will ask for new namespaces, so 
> copy_namespaces can't return an error. Similarly, I don't see how 
> copy_thread() could either (at least on x86 it can only return an error if 
> an IO bitmap allocation fails, I think - again something that shouldn't 
> happen for kernel threads. And most other architectures will never fail 
> at all, I do believe).
> 
> 
>>(My modified kernel makes it much more likely which is how I found it.)
>>The attached patch is against 2.6.9-rc4. This time for sure!
> 
> 
> I don't mind the patch per se, but I'd rather put it in after 2.6.9 unless
> you can tell me how this can actually happen with an unmodified kernel.
> 
> 			Linus
> 

In my kernel, it was a SIGKILL to a forking kernel thread that caused 
the problem. While I see SIGKILLs being sent to some kernel threads, I 
don't know if any of the kernel threads ever fork. If they don't, 
barring a demented root user sending SIGKILLs to kernel threads, I don't 
know if anyone else will ever see this. So, I don't have any problems 
with it being fixed post 2.6.9.

Thanks,

John Byrne






  reply	other threads:[~2004-10-13  3:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-12 23:30 [PATCH] Still a mm bug in the fork error path John Byrne
2004-10-13  2:09 ` Linus Torvalds
2004-10-13  3:27   ` John Byrne [this message]
2004-10-14  4:21     ` Linus Torvalds
2004-10-17 20:26     ` Pavel Machek

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=416CA0B1.20900@hp.com \
    --to=john.l.byrne@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.