linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: akpm@linux-foundation.org, kasong@tencent.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	syzbot+fa43f1b63e3aa6f66329@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm: swap: prevent possible data-race in __try_to_reclaim_swap
Date: Fri, 4 Oct 2024 15:34:21 +0100	[thread overview]
Message-ID: <Zv_87TBZnh2lIwyH@casper.infradead.org> (raw)
In-Reply-To: <20241004142504.4379-1-aha310510@gmail.com>

On Fri, Oct 04, 2024 at 11:25:04PM +0900, Jeongjun Park wrote:
> A report [1] was uploaded from syzbot.
> 
> In the previous commit 862590ac3708 ("mm: swap: allow cache reclaim to skip 
> slot cache"), the __try_to_reclaim_swap() function reads offset and nr_pages 
> from folio without folio_lock protection. 

Umm.  You don't need folio_lock to read nr_pages.  Holding a refcount
is sufficient to stabilise nr_pages.  I cannot speak to folio->swap
though (and the KCSAN report does appear to be pointing to folio->swap).



  reply	other threads:[~2024-10-04 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04 14:25 Jeongjun Park
2024-10-04 14:34 ` Matthew Wilcox [this message]
2024-10-04 14:50   ` Jeongjun Park
2024-10-06 20:15 ` Kairui Song
2024-10-07  0:49   ` Jeongjun Park
2024-10-07  5:06 ` kernel test robot
2024-10-08  1:30   ` Andrew Morton
2024-10-08  2:35     ` Jeongjun Park

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=Zv_87TBZnh2lIwyH@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=aha310510@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=syzbot+fa43f1b63e3aa6f66329@syzkaller.appspotmail.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