Commit d614fd58 authored by Dave Martin's avatar Dave Martin Committed by Linus Torvalds

mips/ptrace: Preserve previous registers for short regset write

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.
Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7195ee31
...@@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *target, ...@@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *target,
&target->thread.fpu, &target->thread.fpu,
0, sizeof(elf_fpregset_t)); 0, sizeof(elf_fpregset_t));
for (i = 0; i < NUM_FPU_REGS; i++) { BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t));
for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) {
err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&fpr_val, i * sizeof(elf_fpreg_t), &fpr_val, i * sizeof(elf_fpreg_t),
(i + 1) * sizeof(elf_fpreg_t)); (i + 1) * sizeof(elf_fpreg_t));
......
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