linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Dawson Engler <engler@csl.stanford.edu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [CHECKER] races in 2.5.65/mm/swapfile.c?
Date: Sat, 22 Mar 2003 04:12:51 -0800	[thread overview]
Message-ID: <20030322041251.7720e42f.akpm@digeo.com> (raw)
In-Reply-To: <200303221145.h2MBjAW09391@csl.stanford.edu>

Dawson Engler <engler@csl.stanford.edu> wrote:
>
> Hi All,
> 
> mm/swapfile.c seems to have three potential races.
> 
> The first two are in 
>         linux-2.5.62/mm/swap_state.c:87:add_to_swap_cache
> 
> which seems reachable without a lock from the callchain:
> 
>         mm/swapfile.c:sys_swapoff:998->
>               sys_swapoff:1026->
>                 try_to_unuse:591->
>                         mm/swap_state.c:read_swap_cache_async:377->
>                             add_to_swap_cache
> 
> add_to_swap_cache increments two global variables without a lock:
>         INC_CACHE_INFO(add_total);
> and
>         INC_CACHE_INFO(exist_race);

These are just instrumentation.  If they're a bit inaccurate nobody cares,
and they're not worth locking.

So yes, that is a positive.

> The final one is in
>         linux-2.5.62/mm/swapfile.c:213:swap_entry_free
> which seems to increment
>         nr_swap_pages++;
> without a lock.

swap_entry_free() is called after swap_info_get(), which locks the swap
device list and the particular swap device.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-22 11:45 Dawson Engler
2003-03-22 12:12 ` 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=20030322041251.7720e42f.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=engler@csl.stanford.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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