linux-mips
[Top] [All Lists]

[PATCH] FIx mprotect() syscall for MIPS32 w/36-bit physical address supp

To: linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH] FIx mprotect() syscall for MIPS32 w/36-bit physical address support
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Date: Sat, 08 Apr 2006 03:09:52 +0400
Cc: Clem Taylor <clem.taylor@gmail.com>, Jordan Crouse <jordan.crouse@amd.com>, Manish Lachwani <mlachwani@mvista.com>
In-reply-to: <20060202165436.GB17352@linux-mips.org>
Organization: MontaVista Software Inc.
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <ecb4efd10512071351scea736fg8d026e3fa3c54c79@mail.gmail.com> <20060202165436.GB17352@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
Hello.

    Fix mprotect() syscall for MIPS32 CPUs with 36-bit physical address
support: pte_modify() macro didn't clear the hardware page protection bits
before modifying...

WBR, Sergei

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 702a28f..80b3605 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -335,8 +335,9 @@ static inline pgprot_t pgprot_noncached(
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
-       pte.pte_low &= _PAGE_CHG_MASK;
-       pte.pte_low |= pgprot_val(newprot);
+       pte.pte_low  &= _PAGE_CHG_MASK;
+       pte.pte_high &= ~0x3f;
+       pte.pte_low  |= pgprot_val(newprot);
        pte.pte_high |= pgprot_val(newprot) & 0x3f;
        return pte;
 }

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] FIx mprotect() syscall for MIPS32 w/36-bit physical address support, Sergei Shtylyov <=