diff options
author | Marcin Nowakowski <marcin.nowakowski@imgtec.com> | 2016-09-22 09:38:32 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-09-29 12:59:49 -0400 |
commit | ddabfa5c2e33f1b495f3e0176de7057850915c0b (patch) | |
tree | 822ba923abc3cc07492ddc4d4465e74ae500fff9 | |
parent | db06068a4fd44a57b642b369d2a295b8448f6b65 (diff) |
MIPS: uprobes: remove incorrect set_orig_insn
Generic kernel code implements a weak version of set_orig_insn that
moves cached 'insn' from arch_uprobe to the original code location when
the trap is removed.
MIPS variant used arch_uprobe->orig_inst which was never initialised
properly, so this code only inserted a nop instead of the original
instruction. With that change orig_inst can also be safely removed.
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Fixes: 40e084a506eb ('MIPS: Add uprobes support.')
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14299/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/uprobes.h | 1 | ||||
-rw-r--r-- | arch/mips/kernel/uprobes.c | 18 |
2 files changed, 0 insertions, 19 deletions
diff --git a/arch/mips/include/asm/uprobes.h b/arch/mips/include/asm/uprobes.h index 34c325c674c4..70a4a2f173ff 100644 --- a/arch/mips/include/asm/uprobes.h +++ b/arch/mips/include/asm/uprobes.h | |||
@@ -36,7 +36,6 @@ struct arch_uprobe { | |||
36 | unsigned long resume_epc; | 36 | unsigned long resume_epc; |
37 | u32 insn[2]; | 37 | u32 insn[2]; |
38 | u32 ixol[2]; | 38 | u32 ixol[2]; |
39 | union mips_instruction orig_inst[MAX_UINSN_BYTES / 4]; | ||
40 | }; | 39 | }; |
41 | 40 | ||
42 | struct arch_uprobe_task { | 41 | struct arch_uprobe_task { |
diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c index cd8a68948066..3b8accb0b4f0 100644 --- a/arch/mips/kernel/uprobes.c +++ b/arch/mips/kernel/uprobes.c | |||
@@ -280,24 +280,6 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, | |||
280 | return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN); | 280 | return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN); |
281 | } | 281 | } |
282 | 282 | ||
283 | /** | ||
284 | * set_orig_insn - Restore the original instruction. | ||
285 | * @mm: the probed process address space. | ||
286 | * @auprobe: arch specific probepoint information. | ||
287 | * @vaddr: the virtual address to insert the opcode. | ||
288 | * | ||
289 | * For mm @mm, restore the original opcode (opcode) at @vaddr. | ||
290 | * Return 0 (success) or a negative errno. | ||
291 | * | ||
292 | * This overrides the weak version in kernel/events/uprobes.c. | ||
293 | */ | ||
294 | int set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, | ||
295 | unsigned long vaddr) | ||
296 | { | ||
297 | return uprobe_write_opcode(mm, vaddr, | ||
298 | *(uprobe_opcode_t *)&auprobe->orig_inst[0].word); | ||
299 | } | ||
300 | |||
301 | void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, | 283 | void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, |
302 | void *src, unsigned long len) | 284 | void *src, unsigned long len) |
303 | { | 285 | { |