powerpc/mm: handle protnone ptes on fork
authorAneesh Kumar K.V <[email protected]>
Fri, 10 Mar 2017 00:16:36 +0000 (16:16 -0800)
committerLinus Torvalds <[email protected]>
Fri, 10 Mar 2017 01:01:09 +0000 (17:01 -0800)
commit52c50ca75c534c0772b71900a29b3a71439b32ef
tree0b2327e49bdb162839667fadcd96ce42b3fd589e
parent505d3085d7120a9f4cd0d6ffaa876968854b3baa
powerpc/mm: handle protnone ptes on fork

We need to mark pages of parent process read only on fork.  Numa fault
pte needs a protnone ptes variant with saved write flag set.  On fork we
need to make sure we remove the saved write bit.  Instead of adding the
protnone check in the caller update ptep_set_wrprotect variants to clear
savedwrite bit.

Without this we see random segfaults in application on fork.

Fixes: c137a2757b886 ("powerpc/mm/autonuma: switch ppc64 to its own implementation of saved write")
Link: http://lkml.kernel.org/r/1488203787-17849-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Michael Ellerman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/powerpc/include/asm/book3s/64/pgtable.h