]> git.baikalelectronics.ru Git - kernel.git/commit
mremap: move_ptes: check pte dirty after its removal
authorAaron Lu <aaron.lu@intel.com>
Tue, 29 Nov 2016 05:27:31 +0000 (13:27 +0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Nov 2016 16:20:24 +0000 (08:20 -0800)
commit392b5246593468d0429d5cc97768d28f198140ea
tree10b193706622c09b1b23c540359de7d75557a5a7
parentec17ba59c3be92b88e58719a7efcaef2530f0808
mremap: move_ptes: check pte dirty after its removal

Linus found there still is a race in mremap after commit d313a4835e23
("mremap: fix race between mremap() and page cleanning").

As described by Linus:
 "the issue is that another thread might make the pte be dirty (in the
  hardware walker, so no locking of ours will make any difference)
  *after* we checked whether it was dirty, but *before* we removed it
  from the page tables"

Fix it by moving the check after we removed it from the page table.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/huge_memory.c
mm/mremap.c