Commit 824865e1 authored by Marcin Nowakowski's avatar Marcin Nowakowski Committed by Greg Kroah-Hartman

MIPS: uprobes: remove incorrect set_orig_insn

commit ddabfa5c upstream.

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: default avatarMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Fixes: 40e084a5 ('MIPS: Add uprobes support.')
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14299/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9b228c19
...@@ -36,7 +36,6 @@ struct arch_uprobe { ...@@ -36,7 +36,6 @@ struct arch_uprobe {
unsigned long resume_epc; unsigned long resume_epc;
u32 insn[2]; u32 insn[2];
u32 ixol[2]; u32 ixol[2];
union mips_instruction orig_inst[MAX_UINSN_BYTES / 4];
}; };
struct arch_uprobe_task { struct arch_uprobe_task {
......
...@@ -280,24 +280,6 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, ...@@ -280,24 +280,6 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm,
return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN); return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN);
} }
/**
* set_orig_insn - Restore the original instruction.
* @mm: the probed process address space.
* @auprobe: arch specific probepoint information.
* @vaddr: the virtual address to insert the opcode.
*
* For mm @mm, restore the original opcode (opcode) at @vaddr.
* Return 0 (success) or a negative errno.
*
* This overrides the weak version in kernel/events/uprobes.c.
*/
int set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
unsigned long vaddr)
{
return uprobe_write_opcode(mm, vaddr,
*(uprobe_opcode_t *)&auprobe->orig_inst[0].word);
}
void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len) void *src, unsigned long len)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment