Re: [PATCH] mm: Avoid data corruption on CoW fault into PFN-mapped VMA
From: Andrew Morton
Date: Wed Feb 19 2020 - 16:22:43 EST
On Tue, 18 Feb 2020 18:41:51 +0300 "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> wrote:
> Jeff Moyer has reported that one of xfstests triggers a warning when run
> on DAX-enabled filesystem:
> WARNING: CPU: 76 PID: 51024 at mm/memory.c:2317 wp_page_copy+0xc40/0xd50
> wp_page_copy+0x98c/0xd50 (unreliable)
> The warning happens on failed __copy_from_user_inatomic() which tries to
> copy data into a CoW page.
> This happens because of race between MADV_DONTNEED and CoW page fault:
> CPU0 CPU1
> <TLB flush>
> sees empty PTE and fails
> The solution is to re-try __copy_from_user_inatomic() under PTL after
> checking that PTE is matches the orig_pte.
> The second copy attempt can still fail, like due to non-readable PTE,
> but there's nothing reasonable we can do about, except clearing the CoW
You don't think this is worthy of a cc:stable?