Skip to content

Commit

Permalink
powerpc/8xx: fix handling of early NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed Jul 19, 2018
1 parent ce57c66 commit 8c8c10b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arch/powerpc/kernel/head_8xx.S
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,10 @@ start_here:
li r0,0
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)

lis r6, swapper_pg_dir@ha
tophys(r6,r6)
mtspr SPRN_M_TW, r6

bl early_init /* We have to do this with MMU on */

/*
Expand All @@ -893,9 +897,6 @@ start_here:
* init's THREAD like the context switch code does, but this is
* easier......until someone changes init's static structures.
*/
lis r6, swapper_pg_dir@ha
tophys(r6,r6)
mtspr SPRN_M_TW, r6
lis r4,2f@h
ori r4,r4,2f@l
tophys(r4,r4)
Expand Down

0 comments on commit 8c8c10b

Please sign in to comment.