]>
Commit | Line | Data |
---|---|---|
79adb0ff GKH |
1 | From 9a17b876b573441bfb3387ad55d98bf7184daf9d Mon Sep 17 00:00:00 2001 |
2 | From: Dave Martin <Dave.Martin@arm.com> | |
3 | Date: Wed, 18 Jan 2017 16:25:20 +0000 | |
4 | Subject: arm64/ptrace: Preserve previous registers for short regset write | |
5 | ||
6 | From: Dave Martin <Dave.Martin@arm.com> | |
7 | ||
8 | commit 9a17b876b573441bfb3387ad55d98bf7184daf9d upstream. | |
9 | ||
10 | Ensure that if userspace supplies insufficient data to | |
11 | PTRACE_SETREGSET to fill all the registers, the thread's old | |
12 | registers are preserved. | |
13 | ||
14 | Fixes: 478fcb2cdb23 ("arm64: Debugging support") | |
15 | Signed-off-by: Dave Martin <Dave.Martin@arm.com> | |
16 | Acked-by: Will Deacon <Will.Deacon@arm.com> | |
17 | Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> | |
18 | Signed-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) |