Skip to content

Commit 8c8c10b

Browse files
chleroympe
authored andcommitted
powerpc/8xx: fix handling of early NULL pointer dereference
NULL pointers are pointers to user memory space. So user pagetable has to be set in order to avoid random behaviour in case of NULL pointer dereference, otherwise we may encounter random memory access hence Machine Check Exception from TLB Miss handlers. Set user pagetable as early as possible in order to properly catch early kernel NULL pointer dereference. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent ce57c66 commit 8c8c10b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/powerpc/kernel/head_8xx.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,10 @@ start_here:
873873
li r0,0
874874
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
875875

876+
lis r6, swapper_pg_dir@ha
877+
tophys(r6,r6)
878+
mtspr SPRN_M_TW, r6
879+
876880
bl early_init /* We have to do this with MMU on */
877881

878882
/*
@@ -893,9 +897,6 @@ start_here:
893897
* init's THREAD like the context switch code does, but this is
894898
* easier......until someone changes init's static structures.
895899
*/
896-
lis r6, swapper_pg_dir@ha
897-
tophys(r6,r6)
898-
mtspr SPRN_M_TW, r6
899900
lis r4,2f@h
900901
ori r4,r4,2f@l
901902
tophys(r4,r4)

0 commit comments

Comments
 (0)