]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.11.6/arc-ignore-ptrace-setregset-request-for-synthetic-register-stop_pc.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.11.6 / arc-ignore-ptrace-setregset-request-for-synthetic-register-stop_pc.patch
1 From 5b24282846c064ee90d40fcb3a8f63b8e754fd28 Mon Sep 17 00:00:00 2001
2 From: Vineet Gupta <vgupta@synopsys.com>
3 Date: Thu, 10 Oct 2013 19:33:57 +0530
4 Subject: ARC: Ignore ptrace SETREGSET request for synthetic register "stop_pc"
5
6 From: Vineet Gupta <vgupta@synopsys.com>
7
8 commit 5b24282846c064ee90d40fcb3a8f63b8e754fd28 upstream.
9
10 ARCompact TRAP_S insn used for breakpoints, commits before exception is
11 taken (updating architectural PC). So ptregs->ret contains next-PC and
12 not the breakpoint PC itself. This is different from other restartable
13 exceptions such as TLB Miss where ptregs->ret has exact faulting PC.
14 gdb needs to know exact-PC hence ARC ptrace GETREGSET provides for
15 @stop_pc which returns ptregs->ret vs. EFA depending on the
16 situation.
17
18 However, writing stop_pc (SETREGSET request), which updates ptregs->ret
19 doesn't makes sense stop_pc doesn't always correspond to that reg as
20 described above.
21
22 This was not an issue so far since user_regs->ret / user_regs->stop_pc
23 had same value and both writing to ptregs->ret was OK, needless, but NOT
24 broken, hence not observed.
25
26 With gdb "jump", they diverge, and user_regs->ret updating ptregs is
27 overwritten immediately with stop_pc, which this patch fixes.
28
29 Reported-by: Anton Kolesov <akolesov@synopsys.com>
30 Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32
33 ---
34 arch/arc/kernel/ptrace.c | 2 +-
35 1 file changed, 1 insertion(+), 1 deletion(-)
36
37 --- a/arch/arc/kernel/ptrace.c
38 +++ b/arch/arc/kernel/ptrace.c
39 @@ -102,7 +102,7 @@ static int genregs_set(struct task_struc
40 REG_IGNORE_ONE(pad2);
41 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */
42 REG_IGNORE_ONE(efa); /* efa update invalid */
43 - REG_IN_ONE(stop_pc, &ptregs->ret); /* stop_pc: PC update */
44 + REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */
45
46 return ret;
47 }