]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.7/mips-uprobes-remove-incorrect-set_orig_insn.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.7.7 / mips-uprobes-remove-incorrect-set_orig_insn.patch
1 From ddabfa5c2e33f1b495f3e0176de7057850915c0b Mon Sep 17 00:00:00 2001
2 From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
3 Date: Thu, 22 Sep 2016 15:38:32 +0200
4 Subject: MIPS: uprobes: remove incorrect set_orig_insn
5
6 From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
7
8 commit ddabfa5c2e33f1b495f3e0176de7057850915c0b upstream.
9
10 Generic kernel code implements a weak version of set_orig_insn that
11 moves cached 'insn' from arch_uprobe to the original code location when
12 the trap is removed.
13 MIPS variant used arch_uprobe->orig_inst which was never initialised
14 properly, so this code only inserted a nop instead of the original
15 instruction. With that change orig_inst can also be safely removed.
16
17 Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
18 Fixes: 40e084a506eb ('MIPS: Add uprobes support.')
19 Cc: linux-mips@linux-mips.org
20 Patchwork: https://patchwork.linux-mips.org/patch/14299/
21 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 arch/mips/include/asm/uprobes.h | 1 -
26 arch/mips/kernel/uprobes.c | 18 ------------------
27 2 files changed, 19 deletions(-)
28
29 --- a/arch/mips/include/asm/uprobes.h
30 +++ b/arch/mips/include/asm/uprobes.h
31 @@ -36,7 +36,6 @@ struct arch_uprobe {
32 unsigned long resume_epc;
33 u32 insn[2];
34 u32 ixol[2];
35 - union mips_instruction orig_inst[MAX_UINSN_BYTES / 4];
36 };
37
38 struct arch_uprobe_task {
39 --- a/arch/mips/kernel/uprobes.c
40 +++ b/arch/mips/kernel/uprobes.c
41 @@ -280,24 +280,6 @@ int __weak set_swbp(struct arch_uprobe *
42 return uprobe_write_opcode(mm, vaddr, UPROBE_SWBP_INSN);
43 }
44
45 -/**
46 - * set_orig_insn - Restore the original instruction.
47 - * @mm: the probed process address space.
48 - * @auprobe: arch specific probepoint information.
49 - * @vaddr: the virtual address to insert the opcode.
50 - *
51 - * For mm @mm, restore the original opcode (opcode) at @vaddr.
52 - * Return 0 (success) or a negative errno.
53 - *
54 - * This overrides the weak version in kernel/events/uprobes.c.
55 - */
56 -int set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
57 - unsigned long vaddr)
58 -{
59 - return uprobe_write_opcode(mm, vaddr,
60 - *(uprobe_opcode_t *)&auprobe->orig_inst[0].word);
61 -}
62 -
63 void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
64 void *src, unsigned long len)
65 {