The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: linux-kernel@vger.kernel.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] Revert "kmod: fix race in usermodehelper code"
Date: Wed, 23 Sep 2009 20:15:58 -0400	[thread overview]
Message-ID: <20090924001558.GA16772@localhost.localdomain> (raw)
In-Reply-To: <20090923230255.GA18878@Chamillionaire.breakpoint.cc>

On Thu, Sep 24, 2009 at 01:02:55AM +0200, Sebastian Andrzej Siewior wrote:
> This reverts commit c02e3f361:
> |Author: Neil Horman <nhorman@tuxdriver.com>
> |Date:   Tue Sep 22 16:43:36 2009 -0700
> |
> |    kmod: fix race in usermodehelper code
> |
> |    The user mode helper code has a race in it.  call_usermodehelper_exec()
> |    takes an allocated subprocess_info structure, which it passes to a
> |    workqueue, and then passes it to a kernel thread which it creates, after
> |    which it calls complete to signal to the caller of
> |    call_usermodehelper_exec() that it can free the subprocess_info struct.
> |
> |    But since we use that structure in the created thread, we can't call
> |    complete from __call_usermodehelper(), which is where we create the kernel
> |    thread.  We need to call complete() from within the kernel thread and then
> |    not use subprocess_info afterward in the case of UMH_WAIT_EXEC.  Tested
> |    successfully by me.
> |
> |    Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> |    Cc: Rusty Russell <rusty@rustcorp.com.au>
> |    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> |    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> 
> The pach is wrong IMHO. UMH_WAIT_EXEC is called with VFORK what ensures
> that the child finishes prior returing back to the parent. No race. The patch
> makes it even worse because it does the thing it claims not do:
Dang, you're right.  I completely missed the use of CLONE_VFORK as a mechanism
to prevent the parent from racing ahead of the child.  Sorry for the noise.
Neil

> 

      parent reply	other threads:[~2009-09-24  0:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 23:02 [PATCH] Revert "kmod: fix race in usermodehelper code" Sebastian Andrzej Siewior
2009-09-23 23:43 ` Linus Torvalds
2009-09-24  0:15 ` Neil Horman [this message]

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=20090924001558.GA16772@localhost.localdomain \
    --to=nhorman@tuxdriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sebastian@breakpoint.cc \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox