Skip to content

Commit 24ea500

Browse files
mpeintel-lab-lkp
authored andcommitted
powerpc/64: Make stack tracing work during very early boot
If we try to stack trace very early during boot, either due to a WARN/BUG or manual dump_stack(), we will oops in valid_emergency_stack() when we try to dereference the paca_ptrs array. The fix is simple, we just return false if paca_ptrs isn't allocated yet. The stack pointer definitely isn't part of any emergency stack because we haven't allocated any yet. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 6895c5b commit 24ea500

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/powerpc/kernel/process.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,9 @@ static inline int valid_emergency_stack(unsigned long sp, struct task_struct *p,
20472047
unsigned long stack_page;
20482048
unsigned long cpu = task_cpu(p);
20492049

2050+
if (!paca_ptrs)
2051+
return 0;
2052+
20502053
stack_page = (unsigned long)paca_ptrs[cpu]->emergency_sp - THREAD_SIZE;
20512054
if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes)
20522055
return 1;

0 commit comments

Comments
 (0)