Skip to content

Commit dadb86f

Browse files
chleroygregkh
authored andcommitted
powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
[ Upstream commit 5d9cea8 ] On 8xx, PAGE_NONE is handled by setting _PAGE_NA instead of clearing _PAGE_USER. But then pte_user() returns 1 also for PAGE_NONE. As _PAGE_NA prevent reads, add a specific version of pte_read() that returns 0 when _PAGE_NA is set instead of always returning 1. Fixes: 3517503 ("powerpc/mm: Introduce _PAGE_NA") Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/57bcfbe578e43123f9ed73e040229b80f1ad56ec.1695659959.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin <[email protected]>
1 parent 288a059 commit dadb86f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/powerpc/include/asm/nohash/32/pte-8xx.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ static inline pte_t pte_wrprotect(pte_t pte)
9494

9595
#define pte_wrprotect pte_wrprotect
9696

97+
static inline int pte_read(pte_t pte)
98+
{
99+
return (pte_val(pte) & _PAGE_RO) != _PAGE_NA;
100+
}
101+
102+
#define pte_read pte_read
103+
97104
static inline int pte_write(pte_t pte)
98105
{
99106
return !(pte_val(pte) & _PAGE_RO);

arch/powerpc/include/asm/nohash/pgtable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ static inline int pte_write(pte_t pte)
4545
return pte_val(pte) & _PAGE_RW;
4646
}
4747
#endif
48+
#ifndef pte_read
4849
static inline int pte_read(pte_t pte) { return 1; }
50+
#endif
4951
static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
5052
static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
5153
static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }

0 commit comments

Comments
 (0)