Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612848

[PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write
Date 2017-03-30 12:10 +0200
Message-ID <tqFbJ-4Hn-67@gated-at.bofh.it> (permalink)
References <tqFbH-4Hn-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Martin <Dave.Martin@arm.com>

commit d614fd58a2834cfe4efa472c33c8f3ce2338b09b upstream.

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: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/ptrace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *t
 					  &target->thread.fpu,
 					  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,
 					 &fpr_val, i * sizeof(elf_fpreg_t),
 					 (i + 1) * sizeof(elf_fpreg_t));

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/14] 4.4.59-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  [PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  [PATCH 4.4 09/14] sparc/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  [PATCH 4.4 02/14] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  [PATCH 4.4 06/14] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  [PATCH 4.4 03/14] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
  Re: [PATCH 4.4 00/14] 4.4.59-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-30 21:00 +0200
  Re: [PATCH 4.4 00/14] 4.4.59-stable review Guenter Roeck <linux@roeck-us.net> - 2017-03-31 05:50 +0200

csiph-web