From: Andrew Morton <akpm@linux-foundation.org>
To: Kairui Song <ryncsn@gmail.com>
Cc: Chris Li <chrisl@kernel.org>,
linux-mm@kvack.org, Barry Song <21cnbao@gmail.com>,
Peter Xu <peterx@redhat.com>,
Suren Baghdasaryan <surenb@google.com>,
Andrea Arcangeli <aarcange@redhat.com>,
David Hildenbrand <david@redhat.com>,
Lokesh Gidra <lokeshgidra@google.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] mm: userfaultfd: fix race of userfaultfd_move and swap cache
Date: Wed, 11 Jun 2025 17:19:50 -0700 [thread overview]
Message-ID: <20250611171950.5cb2d563c2935a93f5c7bbc0@linux-foundation.org> (raw)
In-Reply-To: <CAMgjq7BhLdQNKs7aT1Eopvgdwug3qEU4tP7xgj4VTjHBE36dPA@mail.gmail.com>
On Wed, 11 Jun 2025 13:16:25 +0800 Kairui Song <ryncsn@gmail.com> wrote:
> This commit fixes two kinds of races, they may have different results:
>
> Barry reported a BUG_ON in commit c50f8e6053b0, we may see the same
> BUG_ON if the filemap lookup returned NULL and folio is added to swap
> cache after that.
>
> If another kind of race is triggered (folio changed after lookup) we
> may see RSS counter is corrupted:
>
> [ 406.893936] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0
> type:MM_ANONPAGES val:-1
> [ 406.894071] BUG: Bad rss-counter state mm:ffff0000c5a9ddc0
> type:MM_SHMEMPAGES val:1
>
> Because the folio is being accounted to the wrong VMA.
>
> I'm not sure if there will be any data corruption though, seems no.
> The issues above are critical already.
Thanks, I pasted this into the patch's changelog.
prev parent reply other threads:[~2025-06-12 0:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 15:10 Kairui Song
2025-06-04 15:34 ` Peter Xu
2025-06-04 15:39 ` Suren Baghdasaryan
2025-06-05 8:02 ` Barry Song
2025-06-06 0:14 ` Chris Li
2025-06-11 5:16 ` Kairui Song
2025-06-12 0:19 ` 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=20250611171950.5cb2d563c2935a93f5c7bbc0@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=21cnbao@gmail.com \
--cc=aarcange@redhat.com \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lokeshgidra@google.com \
--cc=peterx@redhat.com \
--cc=ryncsn@gmail.com \
--cc=stable@vger.kernel.org \
--cc=surenb@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