arm64: Make !dirty ptes read-only
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 28 Nov 2012 17:06:05 +0000 (17:06 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 29 Nov 2012 15:32:13 +0000 (15:32 +0000)
The AArch64 Linux port relies on the mm code to wrprotect clean ptes.
This however is not the case with newly created ptes and
PAGE_SHARED(_EXEC) is writable but !dirty.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
arch/arm64/include/asm/pgtable.h

index 8960239be722893a8094ceef323da22ff26eef63..937ae2064682e62067b6332ac1940f9f21a77211 100644 (file)
@@ -159,6 +159,8 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
 {
        if (pte_present_exec_user(pte))
                __sync_icache_dcache(pte, addr);
+       if (!pte_dirty(pte))
+               pte = pte_wrprotect(pte);
        set_pte(ptep, pte);
 }