Re: [PATCH] arm64: Fix the ptep_set_wrprotect() to set PTE_DIRTY if (PTE_DBM && !PTE_RDONLY)

From: Catalin Marinas
Date: Thu Mar 10 2016 - 13:40:09 EST


On Thu, Mar 10, 2016 at 08:34:46AM +0530, Ganapatrao Kulkarni wrote:
> > On Wed, Mar 9, 2016 at 9:33 PM, Catalin Marinas <catalin.marinas@xxxxxxx> wrote:
> >> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> >> index 7c73b365fcfa..b409a983f870 100644
> >> --- a/arch/arm64/include/asm/pgtable.h
> >> +++ b/arch/arm64/include/asm/pgtable.h
> >> @@ -201,7 +201,7 @@ extern void __sync_icache_dcache(pte_t pteval, unsigned long addr);
> >> static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
> >> pte_t *ptep, pte_t pte)
> >> {
> >> - if (pte_valid(pte)) {
> >> + if (pte_present(pte)) {
> >> if (pte_sw_dirty(pte) && pte_write(pte))
> >> pte_val(pte) &= ~PTE_RDONLY;
> >> else
>
> this diff works for me.
>
> Tested-by: Ganapatrao Kulkarni <gkulkarni@xxxxxxxxxx>

Thanks. I'll push it out during the merging window and cc stable (though
it needs a slightly different workaround for 4.4 anyway).

--
Catalin