]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Avoid accidental raw backtrace
authorJames Hogan <james.hogan@imgtec.com>
Thu, 29 Jun 2017 14:05:04 +0000 (15:05 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 30 Jun 2017 02:42:15 +0000 (04:42 +0200)
commitf55b1699a525fbdcd1fee0f8f013f6ea0f48ac20
tree018ed1df38ce86f1576e664a3104de867ec95028
parent052ed0c0ac58aabe9256e96782d99d1d34119a8e
MIPS: Avoid accidental raw backtrace

Since commit b0ce2fae450d ("MIPS: Avoid using unwind_stack() with
usermode") show_backtrace() invokes the raw backtracer when
cp0_status & ST0_KSU indicates user mode to fix issues on EVA kernels
where user and kernel address spaces overlap.

However this is used by show_stack() which creates its own pt_regs on
the stack and leaves cp0_status uninitialised in most of the code paths.
This results in the non deterministic use of the raw back tracer
depending on the previous stack content.

show_stack() deals exclusively with kernel mode stacks anyway, so
explicitly initialise regs.cp0_status to KSU_KERNEL (i.e. 0) to ensure
we get a useful backtrace.

Fixes: b0ce2fae450d ("MIPS: Avoid using unwind_stack() with usermode")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.15+
Patchwork: https://patchwork.linux-mips.org/patch/16656/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/traps.c