public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <andi@firstfloor.org>,
	David Howells <dhowells@redhat.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wait_for_helper: SIGCHLD from user-space can lead to use-after-free
Date: Wed, 10 Mar 2010 22:19:23 +0100	[thread overview]
Message-ID: <20100310211923.GA6485@redhat.com> (raw)
In-Reply-To: <20100310203209.54168BCCD@magilla.sf.frob.com>

On 03/10, Roland McGrath wrote:
>
> SIGCHLD being blocked doesn't affect reaping, so SIG_IGN or sa_flags &
> SA_NOCLDWAIT is the only thing that would do this.  How does that come
> about here in this kthread?  Is it inherited from the instigating user
> process?  If so, then SA_NOCLDWAIT is as much a problem as SIG_IGN.
> Or I guess maybe it's from ignore_signals() in kthreadd()?
> In that case SIG_IGN is indeed all that matters.  (I don't really
> know all the kthread/kmod/userhelper code organization.)

Yes. kthreads run with all signal ignored, this is inherited from
kthreadd() which does ignore_signal().

> Perhaps it would be cleaner to do:
>
> 	flush_signal_handlers(current, 1);
>
> in wait_for_helper

I don't think this can work. SIG_DFL for SIGCHLD is OK because it is
sig_kernel_ignore(). But, say, SIGHUP and other signals still should
be ignored, otherwise we have the same problems with the unwanted
signal_pending() this patch tries to avoid.

But even if we could do this,

> That should make it redundant in ____call_usermodehelper,
> so it could be removed from there.

Please note that __call_usermodehelper() forks ____call_usermodehelper() too.

Oleg.


  reply	other threads:[~2010-03-10 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 17:16 [PATCH] wait_for_helper: SIGCHLD from user-space can lead to use-after-free Oleg Nesterov
2010-03-10 18:07 ` Neil Horman
2010-03-10 20:32 ` Roland McGrath
2010-03-10 21:19   ` Oleg Nesterov [this message]
2010-03-10 21:27     ` Roland McGrath

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=20100310211923.GA6485@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    /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