linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Hugh Dickins <hughd@google.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH] mm/swap: Fix pte_same_as_swp() not removing uffd-wp bit when compare
Date: Fri, 4 Jun 2021 11:10:31 -0400	[thread overview]
Message-ID: <YLpCZ6PGxDGt06gQ@t490s> (raw)
In-Reply-To: <alpine.LSU.2.11.2106032015250.12760@eggly.anvils>

On Thu, Jun 03, 2021 at 08:26:02PM -0700, Hugh Dickins wrote:
> On Thu, 3 Jun 2021, Peter Xu wrote:
> 
> > I found it by pure code review, that pte_same_as_swp() of unuse_vma() didn't
> 
> Yes, that is an odd corner, easily missed.
> 
> > take uffd-wp bit into account when comparing ptes.  pte_same_as_swp() returning
> > false negative could cause failure to swapoff swap ptes that was wr-protected
> > by userfaultfd.
> > 
> > Cc: Hugh Dickins <hughd@google.com>
> > Cc: Andrea Arcangeli <aarcange@redhat.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> 
> I expect you're right: swapoff used to hang forever (but interruptibly)
> when this went wrong on powerpc originally.  I don't know the uffd_wp
> (nor the soft_dirty) end of it, but treating uffd_wp and soft_dirty
> together looks a very good approach, so I'll venture an
> 
> Acked-by: Hugh Dickins <hughd@google.com>

Thanks!

> 
> But I think it should have a uffd_wp Fixes tag and be Cc stable.

Yes, should be:

Cc: stable@vger.kernel.org # v5.7+
Fixes: f45ec5ff16a7 ("userfaultfd: wp: support swap and page migration")

-- 
Peter Xu



      reply	other threads:[~2021-06-04 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 18:05 [PATCH] mm/swap: Fix pte_same_as_swp() not removing uffd-wp bit when compare Peter Xu
2021-06-04  3:26 ` Hugh Dickins
2021-06-04 15:10   ` Peter Xu [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=YLpCZ6PGxDGt06gQ@t490s \
    --to=peterx@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --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;
as well as URLs for NNTP newsgroup(s).