[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YLpCZ6PGxDGt06gQ@t490s>
Date: Fri, 4 Jun 2021 11:10:31 -0400
From: Peter Xu <peterx@...hat.com>
To: Hugh Dickins <hughd@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH] mm/swap: Fix pte_same_as_swp() not removing uffd-wp bit
when compare
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@...gle.com>
> > Cc: Andrea Arcangeli <aarcange@...hat.com>
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Signed-off-by: Peter Xu <peterx@...hat.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@...gle.com>
Thanks!
>
> But I think it should have a uffd_wp Fixes tag and be Cc stable.
Yes, should be:
Cc: stable@...r.kernel.org # v5.7+
Fixes: f45ec5ff16a7 ("userfaultfd: wp: support swap and page migration")
--
Peter Xu
Powered by blists - more mailing lists