提交 698b8510 编写于 作者: M Marcin Nowakowski 提交者: Ralf Baechle

MIPS: kprobes: flush_insn_slot should flush only if probe initialised

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: c1bf207d ("MIPS: kprobe: Add support.")
Signed-off-by: NMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16296/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 87051ec1
...@@ -43,7 +43,8 @@ typedef union mips_instruction kprobe_opcode_t; ...@@ -43,7 +43,8 @@ typedef union mips_instruction kprobe_opcode_t;
#define flush_insn_slot(p) \ #define flush_insn_slot(p) \
do { \ do { \
flush_icache_range((unsigned long)p->addr, \ if (p->addr) \
flush_icache_range((unsigned long)p->addr, \
(unsigned long)p->addr + \ (unsigned long)p->addr + \
(MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \ (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
} while (0) } while (0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册