public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: mm_release() call in exit_mm() looks dangerous
Date: Mon, 12 Nov 2007 16:48:02 -0800	[thread overview]
Message-ID: <4738F442.3040905@goop.org> (raw)
In-Reply-To: <9a8748490711111540q10503eday7f06b3e72b20fe82@mail.gmail.com>

Jesper Juhl wrote:
> In kernel/exit.c we have this code :
>
> static void exit_mm(struct task_struct * tsk)
> {
>         struct mm_struct *mm = tsk->mm;
>
>         mm_release(tsk, mm);
>         if (!mm)
>                 return;
> ...
>
>
> But, mm_release() may dereference it's second argument ('mm'), so
> shouldn't we be doing the "!mm" test *before* we call mm_release() and
> not after?
> I don't know the mm code well enough to be able to tell if some of the
> other stuff mm_release does needs to be done always and the mm
> dereference can't actually happen, but maybe someone else who knows
> the code better can tell...  In any case, what's currently there looks
> a little shaky..
>   

Yeah, it looks wrong.  mm_release() calls deactivate_mm() as its first
act, which could well dereference mm (though it often doesn't).

    J

  reply	other threads:[~2007-11-13  0:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11 23:40 mm_release() call in exit_mm() looks dangerous Jesper Juhl
2007-11-13  0:48 ` Jeremy Fitzhardinge [this message]
2007-11-16  0:34   ` Jesper Juhl
2007-11-16  2:25     ` [Patch] kernel/exit.c: Fix use-before-check in exit_mm() WANG Cong

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=4738F442.3040905@goop.org \
    --to=jeremy@goop.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.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