mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Dawson Engler <engler@csl.stanford.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [CHECKER] race in 2.5.62/fs/exec.c?
Date: Sat, 22 Mar 2003 13:45:01 -0800	[thread overview]
Message-ID: <20030322134501.543c4d52.akpm@digeo.com> (raw)
In-Reply-To: <200303221940.h2MJeml23812@csl.stanford.edu>

Dawson Engler <engler@csl.stanford.edu> wrote:
>
> I'm not sure if I'm missing something --- is the following a race?
> 
>            2.5.62/fs/exec.c:1013:search_binary_handler:
>                         read_unlock(&binfmt_lock);
>                         retval = fn(bprm, regs);
>                         if (retval >= 0) {
>                                 put_binfmt(fmt);

Don't think so.

That lock protects the global list of registered formats only.  Because we
have a ref against the format's underlying module when that lock is dropped,
the module cannot be unloaded and nobody can unregister the format.  Hence
the thing at *fmt is stable, and reading fmt->next after retaking the lock is
safe.

The particular piece of code you quote would be buggy if it continued
to go around the loop and again used fmt->next.  But it will unconditionally
return after performing the put_binfmt() call.

      reply	other threads:[~2003-03-22 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-22 19:40 Dawson Engler
2003-03-22 21:45 ` Andrew Morton [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=20030322134501.543c4d52.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=engler@csl.stanford.edu \
    --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

all inboxes | Powered by JetHome®