All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Paul Mundt <lethal@linux-sh.org>,
	Russell King <linux@arm.linux.org.uk>,
	Mike Frysinger <vapier@gentoo.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] arm: Fix possible race on task->mm
Date: Fri, 10 Feb 2012 21:21:31 +0100	[thread overview]
Message-ID: <20120210202131.GA21408@redhat.com> (raw)
In-Reply-To: <20120209154336.GA4769@oksana.dev.rtsoft.ru>

On 02/09, Anton Vorontsov wrote:
>
> On Thu, Feb 09, 2012 at 07:33:46PM +0400, Anton Vorontsov wrote:
> > On Wed, Feb 08, 2012 at 05:08:08PM +0100, Oleg Nesterov wrote:
> > > On 02/07, Anton Vorontsov wrote:
> > > >
> > > > Checking for task->mm is dangerous as ->mm might disappear (exit_mm()
> > > > assigns NULL under task_lock(), so tasklist lock is not enough).
> > > >
> > > > We can't use get_task_mm()/mmput() pair as mmput() might sleep,
> > >
> > > Yes, but
> > >
> > > > so let's take the task lock while we care about its mm.
> > >
> > > it seems that this needs find_lock_task_mm() too ?
> > >
> > > the same for the rest patches in this series.
> >
> > Yep, I think you're right, will add this change.
>
> Thinking about it more... making the code use find_lock_task_mm
> would be a behaviour change. Sure, in trivial cases like ARM this
> looks like a 100% safe thing to do, but in e.g. UML case, I
> wouldn't bet much money on that 'mm->context.id.u.pid' would be
> still meaningful.

OK, perhaps UML differs. I don't know what context.id.u.pid means.
Although at first glance it would be meaningful anyway...

> So, I'd rather do it in a separate change, so this can be easily
> reverted.

In the !UML case find_lock_task_mm() "obviously looks like the right
thing...

But I won't argue, up to you.

Oleg.


  reply	other threads:[~2012-02-10 20:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07  6:48 [PATCH 0/8] Fixes for common mistakes w/ for_each_process and task->mm Anton Vorontsov
2012-02-07  6:49 ` [PATCH 1/8] sysrq: Fix possible race with exiting task Anton Vorontsov
2012-02-09  1:47   ` David Rientjes
2012-02-07  6:49 ` [PATCH 2/8] sysrq: Properly check for kernel threads Anton Vorontsov
2012-02-09  1:46   ` David Rientjes
2012-02-07  6:50 ` [PATCH 3/8] arm: Fix possible race on task->mm Anton Vorontsov
2012-02-08 16:08   ` Oleg Nesterov
2012-02-09 15:33     ` Anton Vorontsov
2012-02-09 15:43       ` Anton Vorontsov
2012-02-10 20:21         ` Oleg Nesterov [this message]
2012-02-09  1:46   ` David Rientjes
2012-02-07  6:50 ` [PATCH 4/8] powerpc/mm: " Anton Vorontsov
2012-02-07  6:50 ` [PATCH 5/8] sh: " Anton Vorontsov
2012-02-07  6:50 ` [PATCH 6/8] blackfin: " Anton Vorontsov
2012-02-08 16:20   ` Oleg Nesterov
2012-02-07  6:51 ` [PATCH 7/8] um: Should hold tasklist_lock while traversing processes Anton Vorontsov
2012-02-07  6:51 ` [PATCH 8/8] um: Fix possible race on task->mm Anton Vorontsov
2012-02-08 15:59 ` [PATCH 0/8] Fixes for common mistakes w/ for_each_process and task->mm Oleg Nesterov

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=20120210202131.GA21408@redhat.com \
    --to=oleg@redhat.com \
    --cc=anton.vorontsov@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kosaki.motohiro@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=richard@nod.at \
    --cc=vapier@gentoo.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.