Re: [PATCH] mm/swap: Fix pte_same_as_swp() not removing uffd-wp bit when compare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>

Thanks!

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

Yes, should be:

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

-- 
Peter Xu





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux