]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.45/arm64-ptrace-preserve-previous-registers-for-short-regset-write.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.45 / arm64-ptrace-preserve-previous-registers-for-short-regset-write.patch
CommitLineData
79adb0ff
GKH
1From 9a17b876b573441bfb3387ad55d98bf7184daf9d Mon Sep 17 00:00:00 2001
2From: Dave Martin <Dave.Martin@arm.com>
3Date: Wed, 18 Jan 2017 16:25:20 +0000
4Subject: arm64/ptrace: Preserve previous registers for short regset write
5
6From: Dave Martin <Dave.Martin@arm.com>
7
8commit 9a17b876b573441bfb3387ad55d98bf7184daf9d upstream.
9
10Ensure that if userspace supplies insufficient data to
11PTRACE_SETREGSET to fill all the registers, the thread's old
12registers are preserved.
13
14Fixes: 478fcb2cdb23 ("arm64: Debugging support")
15Signed-off-by: Dave Martin <Dave.Martin@arm.com>
16Acked-by: Will Deacon <Will.Deacon@arm.com>
17Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20---
21 arch/arm64/kernel/ptrace.c | 7 ++++---
22 1 file changed, 4 insertions(+), 3 deletions(-)
23
24--- a/arch/arm64/kernel/ptrace.c
25+++ b/arch/arm64/kernel/ptrace.c
26@@ -495,7 +495,7 @@ static int gpr_set(struct task_struct *t
27 const void *kbuf, const void __user *ubuf)
28 {
29 int ret;
30- struct user_pt_regs newregs;
31+ struct user_pt_regs newregs = task_pt_regs(target)->user_regs;
32
33 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newregs, 0, -1);
34 if (ret)
35@@ -525,7 +525,8 @@ static int fpr_set(struct task_struct *t
36 const void *kbuf, const void __user *ubuf)
37 {
38 int ret;
39- struct user_fpsimd_state newstate;
40+ struct user_fpsimd_state newstate =
41+ target->thread.fpsimd_state.user_fpsimd;
42
43 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newstate, 0, -1);
44 if (ret)
45@@ -549,7 +550,7 @@ static int tls_set(struct task_struct *t
46 const void *kbuf, const void __user *ubuf)
47 {
48 int ret;
49- unsigned long tls;
50+ unsigned long tls = target->thread.tp_value;
51
52 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
53 if (ret)