On Mon, Dec 21, 2020 at 1:55 PM Peter Xu <peterx@xxxxxxxxxx> wrote: > > Frankly speaking I don't know why it's always safe to do data copy without the > pgtable lock in wp_page_copy(), since I don't know what guaranteed us from data > changing on the original page due to any reason. So the reason it should be safe is that (a) the pte is write-protected (b) we're clearly not a shared mapping, so that if anybody else writes to the page in another mapping, that's irrelevant (think of it as "page copy happened earlier") (c) before we install the copied page, we check that nothing changed our initial assumption in (a). And the problem is that userfaultfd basically can cause that (c) phase to fail. Linus