Skip to content

Commit 415480d

Browse files
chleroympe
authored andcommitted
powerpc/603: Fix handling of the DIRTY flag
If a page is already mapped RW without the DIRTY flag, the DIRTY flag is never set and a TLB store miss exception is taken forever. This is easily reproduced with the following app: void main(void) { volatile char *ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); *ptr = *ptr; } When DIRTY flag is not set, bail out of TLB miss handler and take a minor page fault which will set the DIRTY flag. Fixes: f8b58c6 ("powerpc/603: let's handle PAGE_DIRTY directly") Cc: stable@vger.kernel.org # v5.1+ Reported-by: Doug Crawford <doug.crawford@intelight-its.com> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/80432f71194d7ee75b2f5043ecf1501cf1cca1f3.1566196646.git.christophe.leroy@c-s.fr
1 parent 6bb2517 commit 415480d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎arch/powerpc/kernel/head_32.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,9 @@ DataStoreTLBMiss:
557557
cmplw 0,r1,r3
558558
mfspr r2, SPRN_SPRG_PGDIR
559559
#ifdef CONFIG_SWAP
560-
li r1, _PAGE_RW | _PAGE_PRESENT | _PAGE_ACCESSED
560+
li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED
561561
#else
562-
li r1, _PAGE_RW | _PAGE_PRESENT
562+
li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT
563563
#endif
564564
bge- 112f
565565
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */

0 commit comments

Comments
 (0)