powerpc/603: Clear C bit when PTE is read only
On book3s/32 MMU, PP bits don't offer kernel RO protection, kernel pages are always RW. However, on the 603 a page fault is always generated when the C bit (change bit = dirty bit) is not set. Enforce kernel RO protection by clearing C bit in TLB miss handler when the page doesn't have _PAGE_RW flag. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/bbb13848ff0100a76ee9ea95118058c30ae95f2c.1643613343.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
9872cbfb45
commit
4634bf4455
|
@ -507,7 +507,9 @@ DataLoadTLBMiss:
|
||||||
/* Convert linux-style PTE to low word of PPC-style PTE */
|
/* Convert linux-style PTE to low word of PPC-style PTE */
|
||||||
rlwinm r1,r0,32-9,30,30 /* _PAGE_RW -> PP msb */
|
rlwinm r1,r0,32-9,30,30 /* _PAGE_RW -> PP msb */
|
||||||
rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */
|
rlwimi r0,r0,32-1,30,30 /* _PAGE_USER -> PP msb */
|
||||||
|
rlwimi r1,r0,32-3,24,24 /* _PAGE_RW -> _PAGE_DIRTY */
|
||||||
rlwimi r0,r0,32-1,31,31 /* _PAGE_USER -> PP lsb */
|
rlwimi r0,r0,32-1,31,31 /* _PAGE_USER -> PP lsb */
|
||||||
|
xori r1,r1,_PAGE_DIRTY /* clear dirty when not rw */
|
||||||
ori r1,r1,0xe04 /* clear out reserved bits */
|
ori r1,r1,0xe04 /* clear out reserved bits */
|
||||||
andc r1,r0,r1 /* PP = user? rw? 1: 3: 0 */
|
andc r1,r0,r1 /* PP = user? rw? 1: 3: 0 */
|
||||||
BEGIN_FTR_SECTION
|
BEGIN_FTR_SECTION
|
||||||
|
|
Loading…
Reference in New Issue