Skip to contentSkip to conversation

Patch "MIPS: Avoid accidental raw backtrace" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: Avoid accidental raw backtrace

to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-avoid-accidental-raw-backtrace.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 854236363370995a609a10b03e35fd3dc5e9e4a1 Mon Sep 17 00:00:00 2001

From: James Hogan <[email protected]>
Date: Thu, 29 Jun 2017 15:05:04 +0100
Subject: MIPS: Avoid accidental raw backtrace

From: James Hogan <[email protected]>

commit 854236363370995a609a10b03e35fd3dc5e9e4a1 upstream.

Since commit 81a76d7119f6 ("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 81a76d7119f6 ("MIPS: Avoid using unwind_stack() with usermode")

Patchwork: https://patchwork.linux-mips.org/patch/16656/

---
 arch/mips/kernel/traps.c |    2 ++
 1 file changed, 2 insertions(+)
arch/mips/kernel/traps.c +2 -0
@@ -201,6 +201,8 @@ void show_stack(struct task_struct *task
 {
 	struct pt_regs regs;
 	mm_segment_t old_fs = get_fs();
+
+	regs.cp0_status = KSU_KERNEL;
 	if (sp) {
 		regs.regs[29] = (unsigned long)sp;
 		regs.regs[31] = 0;

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/mips-avoid-accidental-raw-backtrace.patch queue-4.11/mips-head-reorder-instructions-missing-a-delay-slot.patch