[PATCH v2 2/2] MIPS: Add writable-applies-readable policy with pgrot

From: Bibo Mao
Date: Sat Jun 06 2020 - 00:04:08 EST


On Linux system, writable applies readable privilege in most
architectures, this patch adds this policy on MIPS platform
where hardware rixi is supported.

Signed-off-by: Bibo Mao <maobibo@xxxxxxxxxxx>
---
arch/mips/mm/cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index f814e43..dae0617 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -160,7 +160,7 @@ static inline void setup_protection_map(void)
if (cpu_has_rixi) {
protection_map[0] = __pgprot(__PC | __PP | __NX | __NR);
protection_map[1] = __pgprot(__PC | __PP | __NX | ___R);
- protection_map[2] = __pgprot(__PC | __PP | __NX | __NR);
+ protection_map[2] = __pgprot(__PC | __PP | __NX | ___R);
protection_map[3] = __pgprot(__PC | __PP | __NX | ___R);
protection_map[4] = __pgprot(__PC | __PP | ___R);
protection_map[5] = __pgprot(__PC | __PP | ___R);
@@ -169,7 +169,7 @@ static inline void setup_protection_map(void)

protection_map[8] = __pgprot(__PC | __PP | __NX | __NR);
protection_map[9] = __pgprot(__PC | __PP | __NX | ___R);
- protection_map[10] = __pgprot(__PC | __PP | __NX | ___W | __NR);
+ protection_map[10] = __pgprot(__PC | __PP | __NX | ___W | ___R);
protection_map[11] = __pgprot(__PC | __PP | __NX | ___W | ___R);
protection_map[12] = __pgprot(__PC | __PP | ___R);
protection_map[13] = __pgprot(__PC | __PP | ___R);
--
1.8.3.1