Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1729719 > unrolled thread

[PATCH 3.16 171/233] MIPS: kprobes: flush_insn_slot should flush only if probe initialised

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-09-10 01:10 +0200
Last post2017-09-10 01:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 171/233] MIPS: kprobes: flush_insn_slot should flush  only if probe initialised Ben Hutchings <ben@decadent.org.uk> - 2017-09-10 01:10 +0200

#1729719 — [PATCH 3.16 171/233] MIPS: kprobes: flush_insn_slot should flush only if probe initialised

FromBen Hutchings <ben@decadent.org.uk>
Date2017-09-10 01:10 +0200
Subject[PATCH 3.16 171/233] MIPS: kprobes: flush_insn_slot should flush only if probe initialised
Message-ID<unX2X-3Jz-43@gated-at.bofh.it>
3.16.48-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>

commit 698b851073ddf5a894910d63ca04605e0473414e upstream.

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.")
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16296/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/include/asm/kprobes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/mips/include/asm/kprobes.h
+++ b/arch/mips/include/asm/kprobes.h
@@ -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)

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web