linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Suren Baghdasaryan <surenb@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>,
	aarcange@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: userfaultfd: fix unexpected change to src_folio when UFFDIO_MOVE fails
Date: Wed, 28 Feb 2024 11:46:56 +0100	[thread overview]
Message-ID: <c47c032a-bf47-4c5b-b854-37c33a27cb39@redhat.com> (raw)
In-Reply-To: <CAJuCfpHoxAZvRx2VN+SzsjefB5demhk5OV_wPe8JYnsejgA91w@mail.gmail.com>

On 22.02.24 22:56, Suren Baghdasaryan wrote:
> On Thu, Feb 22, 2024 at 1:00 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>>
>> On Thu, 22 Feb 2024 16:08:15 +0800 Qi Zheng <zhengqi.arch@bytedance.com> wrote:
>>
>>> After ptep_clear_flush(), if we find that src_folio is pinned we will fail
>>> UFFDIO_MOVE and put src_folio back to src_pte entry, but the change to
>>> src_folio->{mapping,index} is not restored in this process. This is not
>>> what we expected, so fix it.
>>>
>>> Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI")
>>
>> What are the expected worst-case userspace-visible runtime effects of
>> this flaw?
> 
> It can cause rmap for that page to be invalid. I guess memory
> corruption might be the visible effect?

At least swapout+migration would no longer work, because we might fail 
to locate the mappings of that folio.

Memory corruption, not sure.

-- 
Cheers,

David / dhildenb



      reply	other threads:[~2024-02-28 10:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  8:08 Qi Zheng
2024-02-22  8:43 ` David Hildenbrand
2024-02-22 21:41   ` Suren Baghdasaryan
2024-02-22 21:00 ` Andrew Morton
2024-02-22 21:56   ` Suren Baghdasaryan
2024-02-28 10:46     ` David Hildenbrand [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=c47c032a-bf47-4c5b-b854-37c33a27cb39@redhat.com \
    --to=david@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.com \
    --cc=zhengqi.arch@bytedance.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