mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Linux-MM <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>, Yu Zhao <yuzhao@google.com>,
	Shakeel Butt <shakeelb@google.com>,
	Alex Shi <alex.shi@linux.alibaba.com>,
	Huang Ying <ying.huang@intel.com>
Subject: [Question] Is there a race window between swapoff vs synchronous swap_readpage
Date: Mon, 29 Mar 2021 21:18:20 +0800	[thread overview]
Message-ID: <364d7ce9-ccb7-fa04-7067-44a96be87060@huawei.com> (raw)

Hi all,
I am investigating the swap code, and I found the below possible race window:

CPU 1							CPU 2
-----							-----
do_swap_page
  skip swapcache case (synchronous swap_readpage)
    alloc_page_vma
							swapoff
							  release swap_file, bdev, or ...
      swap_readpage
	check sis->flags is ok
	  access swap_file, bdev or ...[oops!]
							    si->flags = 0

The swapcache case is ok because swapoff will wait on the page_lock of swapcache page.
Is this will really happen or Am I miss something ?
Any reply would be really grateful. Thanks! :)

             reply	other threads:[~2021-03-29 13:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 13:18 Miaohe Lin [this message]
2021-03-30  1:57 ` Huang, Ying
2021-03-30  3:15   ` Miaohe Lin
2021-03-30  3:44     ` Huang, Ying
2021-03-30  5:47       ` Yu Zhao
2021-03-30  6:57         ` Huang, Ying
2021-03-30  7:27           ` Yu Zhao
2021-04-12  3:12             ` Miaohe Lin
2021-03-30 11:21       ` Miaohe Lin

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=364d7ce9-ccb7-fa04-7067-44a96be87060@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeelb@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yuzhao@google.com \
    /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®