Skip to contentSkip to conversation

Patch "MIPS: kprobes: flush_insn_slot should flush only if probe initialised" has been added to the 3.18-stable tree

PATCH [email protected] 1 participant 1 message Apr 10, 2018

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: kprobes: flush_insn_slot should flush only if probe initialised

to the 3.18-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-kprobes-flush_insn_slot-should-flush-only-if-probe-initialised.patch
and it can be found in the queue-3.18 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 foo@baz Tue Apr 10 13:58:07 CEST 2018

From: Marcin Nowakowski <[email protected]>
Date: Thu, 8 Jun 2017 15:20:32 +0200
Subject: MIPS: kprobes: flush_insn_slot should flush only if probe initialised

From: Marcin Nowakowski <[email protected]>

[ Upstream commit 698b851073ddf5a894910d63ca04605e0473414e ]

When ftrace is used with kprobes, it is possible for a kprobe to contain an invalid location (ie. only initialised to 0 and not to a specific location in the code). Trying to perform a cache flush on such location leads to a crash r4k_flush_icache_range().

Fixes c1bf207d6ee1 ("MIPS: kprobe: Add support.")

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

---
 arch/mips/include/asm/kprobes.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/kprobes.h +2 -1
@@ -40,7 +40,8 @@ typedef union mips_instruction kprobe_op
 
 #define flush_insn_slot(p)						\
 do {									\
-	flush_icache_range((unsigned long)p->addr,			\
+	if (p->addr)							\
+		flush_icache_range((unsigned long)p->addr,		\
 			   (unsigned long)p->addr +			\
 			   (MAX_INSN_SIZE * sizeof(kprobe_opcode_t)));	\
 } while (0)

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

queue-3.18/mips-mm-fixed-mappings-correct-initialisation.patch queue-3.18/mips-kprobes-flush_insn_slot-should-flush-only-if-probe-initialised.patch